Welcome to mirror list, hosted at ThFree Co, Russian Federation.

contacts_helper.rb « helpers « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 379a073dfb4486ac473d6da339824b7fbcd00d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module ContactsHelper
  def contact_aspect_dropdown(contact)
    membership = contact.aspect_memberships.where(:aspect_id => @aspect.id).first unless @aspect.nil?

    if membership
      content_tag(:i, nil, :class => 'entypo circled-cross contact_remove-from-aspect',
                  :title => t('contacts.index.remove_contact'),
                  'data-aspect_id' => @aspect.id,
                  'data-person_id' => contact.person_id,
                  'data-membership_id' => membership.id )

    elsif @aspect.nil?
      render :partial => 'people/relationship_action',
              :locals => { :person => contact.person,
                           :contact => contact,
                           :current_user => current_user }
    else
      content_tag(:i, nil, :class => 'entypo circled-plus contact_add-to-aspect',
                  :title => t('contacts.index.add_contact'),
                  'data-aspect_id' => @aspect.id,
                  'data-person_id' => contact.person_id )
    end
  end

  def start_a_conversation_link(aspect, contacts_size)
    suggested_limit = 16
    conv_opts = { class: "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, facebox: true), conv_opts do
      content_tag(:i, nil, :class => 'entypo mail contacts-header-icon', :title => t('contacts.index.start_a_conversation'))
    end
  end
end