Module: ContactsHelper
- Defined in:
- app/helpers/contacts_helper.rb
Instance Method Summary collapse
- #anonymous_contact_button ⇒ Object
-
#contact_button(contact_or_actor) ⇒ Object
Add contact button.
- #contact_count(actor) ⇒ Object
- #contact_select_options(options) ⇒ Object
- #current_contact_section?(section) ⇒ Boolean
- #signed_in_contact_button(contact_or_actor) ⇒ Object
Instance Method Details
#anonymous_contact_button ⇒ Object
37 38 39 40 41 |
# File 'app/helpers/contacts_helper.rb', line 37 def form_tag new_user_session_path do |f| submit_tag t('contact.new.button.zero') end end |
#contact_button(contact_or_actor) ⇒ Object
Add contact button
11 12 13 14 15 16 17 |
# File 'app/helpers/contacts_helper.rb', line 11 def (contact_or_actor) if user_signed_in? contact_or_actor else end end |
#contact_count(actor) ⇒ Object
2 3 4 5 6 7 8 |
# File 'app/helpers/contacts_helper.rb', line 2 def contact_count(actor) if user_signed_in? t 'contact.in_common', :count => current_subject.common_contacts_count(actor) else t 'contact.n', count: actor.sent_active_contact_count end end |
#contact_select_options(options) ⇒ Object
47 48 49 50 51 52 53 |
# File 'app/helpers/contacts_helper.rb', line 47 def if !.empty? && .first.respond_to?(:last) && Array === .first.last () else () end end |
#current_contact_section?(section) ⇒ Boolean
43 44 45 |
# File 'app/helpers/contacts_helper.rb', line 43 def current_contact_section? section params[:type] == section.to_s end |
#signed_in_contact_button(contact_or_actor) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/contacts_helper.rb', line 19 def contact_or_actor c = if contact_or_actor.is_a?(Contact) contact_or_actor else current_actor.contact_to!(contact_or_actor) end if c.reflexive? t('subject.this_is_you') elsif can? :update, c render partial: "contacts/button", locals: { contact: c } else "" end end |