Module: Crm::PartiesHelper

Defined in:
app/helpers/crm/parties_helper.rb

Overview

View helpers for rendering parties (Contact, Customer, Employee) in
the CRM, e.g. by app/views/call_records/show.html.erb.

Instance Method Summary collapse

Instance Method Details

#party_icon(party, include_name: true) ⇒ String

Renders a Font Awesome icon for a party, optionally with its full name.

Parameters:

  • party (Party)

    the party to render an icon for

  • include_name (Boolean) (defaults to: true)

    whether to append the party's full name

Returns:

  • (String)

    HTML-safe icon markup



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/helpers/crm/parties_helper.rb', line 11

def party_icon(party, include_name: true)
  icon = case party
         when Contact
           'user'
         when Customer
           if party.is_homeowner?
             'user'
           else
             'building'
           end
         when Employee
           'user-tie'
         end
  fa_icon(icon, text: (party.full_name if include_name))
end