fatfreecrm/fat_free_crm

View on GitHub
app/views/home/_account.html.haml

Summary

Maintainability
Test Coverage
- amount = account.opportunities.not_lost.map(&:weighted_amount).sum
%li.highlight[account]
  - if account.category
    .strip{class: account.category} #{t(account.category)}
  - else
    .strip{style: "color: gray;"} #{t :other}

  .indent
    = link_to(h(account.name), account)
    –
    %tt
      = account.location + ", " unless account.location.blank?
      - user_name = account.user.try(:full_name)
      - if user_name
        = t(:added_by, time_ago: timeago(account.created_at), user: h(user_name)).html_safe
      - else
        = t(:added_ago, value: timeago(account.created_at)).html_safe

    - unless current_user.preference[:accounts_index_view] == "accounts_index_brief"
      %dt
        = link_to(account.website, account.website.to_url) + " | " if account.website.present?
        = link_to_email(account.email) + " | " if account.email.present?
        = t(:phone_small) + ": " + (account.toll_free_phone || account.phone) << " | " if account.toll_free_phone? || account.phone?
        = t('pluralize.contact', account.contacts_count) + " | "
        = t('pluralize.opportunity', account.opportunities_count)
      - if account.tags.present?
        %dt
          .tags= tags_for_dashboard(account)
      = hook(:account_bottom, self, account: account)