Module: ContactsHelper

Defined in:
app/helpers/contacts_helper.rb

Instance Method Summary collapse

Instance Method Details

#contact_aspect_dropdown(contact) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/contacts_helper.rb', line 2

def contact_aspect_dropdown(contact)
  membership = contact.aspect_memberships.where(:aspect_id => @aspect.id).first unless @aspect.nil?

  if membership
    link_to((:div, nil, :class => 'icons-monotone_close_exit_delete'),
      { :controller => "aspect_memberships",
        :action => 'destroy',
        :id => membership.id
      },
      :title => t('contacts.index.remove_person_from_aspect', :person_name => contact.person_first_name, :aspect_name => @aspect.name),
      :class => 'contact_remove-from-aspect',
      :method => 'delete',
      'data-membership_id' => membership.id
    )

  else
    render :partial => 'people/relationship_action',
            :locals => { :person => contact.person,
                         :contact => contact,
                         :current_user => current_user }
  end
end

25
26
27
28
29
30
31
32
33
34
# File 'app/helpers/contacts_helper.rb', line 25

def start_a_conversation_link(aspect, contacts_size)
  suggested_limit = 16
  conv_opts = { class: "btn conversation_button", rel: "facebox"}
  conv_opts[:title] = t('.many_people_are_you_sure', suggested_limit: suggested_limit) if contacts_size > suggested_limit
  
  link_to new_conversation_path(aspect_id: aspect.id, name: aspect.name), conv_opts do
    concat t('.start_a_conversation')
    concat (:span, nil, class: "icons-mail")
  end
end