fatfreecrm/fat_free_crm

View on GitHub
app/views/leads/_sidebar_show.html.haml

Summary

Maintainability
Test Coverage
.panel#summary
  %span{style: "float:right"}= avatar_for(@lead, size: "50x50")
  - if !@lead.title.blank? && !@lead.company.blank?
    -# works_at: "{{job_title}} at {{company}}"
    %div= t(:works_at, job_title: @lead.title, company: @lead.company)
  - else
    %div= @lead.title unless @lead.title.blank?
    %div= @lead.company unless @lead.company.blank?

  %div= render "shared/address_show", asset: @lead, type: 'business', title: :address

  %div
    - if @lead.phone.present?
      == #{t :phone}: <b>#{@lead.do_not_call ? content_tag(:strike, @lead.phone) : @lead.phone}</b><br />
    - if @lead.mobile.present?
      == #{t :mobile}: <b>#{@lead.do_not_call ? content_tag(:strike, @lead.mobile) : @lead.mobile}</b><br />
    - if @lead.email.present?
      == #{t :email}: <b>#{link_to_email(@lead.email)}</b><br />
    - if @lead.alt_email.present?
      == #{t :other}: <b>#{link_to_email(@lead.alt_email)}</b><br />
  = web_presence_icons(@lead)

  .caption #{t :lead_summary}
  %dl
    %li
      %dt= t(@lead.status, default: :n_a)
      %tt #{t :status}:
    %li
      %dt= t(@lead.source, default: :n_a)
      %tt #{t :source}:
    %li
      %span{style: "float:right;"}= stars_for(@lead)
      %tt #{t :rating}:
    %li
      %dt= @lead.referred_by ? truncate(@lead.referred_by, length: 16) : t(:n_a)
      %tt #{t :referred_by}:
    %li
      %dt= @lead.assigned_to ? truncate(@lead.assignee.full_name, length: 16) : nil
      %tt #{t :assigned_to}:
    %li
      %dt
        - if @lead.campaign
          = link_to(truncate(@lead.campaign.name, length: 16), @lead.campaign, title: @lead.campaign.name)
        - else
          #{t :n_a}
      %tt #{t :campaign}:
    %li
      %dt
        - if @lead.contact
          = link_to(truncate(@lead.contact.name, length: 16), @lead.contact, title: @lead.contact.name)
        - else
          #{t :n_a}
      %tt #{t :contact}:

  - unless @lead.background_info.blank?
    .caption #{t :background_info}
    = auto_link(simple_format @lead.background_info)

  = render "fields/sidebar_show", asset: @lead

  - if @lead.tags.present?
    %dt
      .tags= tags_for_index(@lead)

  = hook(:show_lead_sidebar_bottom, self, lead: @lead)