Module: ContactsHelper

Defined in:
app/helpers/contacts_helper.rb

Instance Method Summary collapse

Instance Method Details

#contact_brief(contact) ⇒ Object



2
3
4
# File 'app/helpers/contacts_helper.rb', line 2

def contact_brief(contact)
  "N contacts in common"
end

#contact_status(a) ⇒ Object



19
20
21
22
23
# File 'app/helpers/contacts_helper.rb', line 19

def contact_status(a)
  current_subject.ties_to?(a) ?
    current_subject.ties_to(a).map(&:relation_name).join(", ") :
    t("contact.new.link")
end

#contact_to(a) ⇒ Object

Show current ties from current user to actor, if they exist, or provide a link to create new ties to actor



8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/contacts_helper.rb', line 8

def contact_to(a)
  if user_signed_in?
    link_to contact_status(a),
            edit_contact_path(current_subject.contact_to!(a)),
                              :title => t("contact.new.title",
                              :name => a.name)
  else
    link_to t("contact.new.link"), new_user_session_path
  end
end