Module: SocialStream::ToolbarConfig::Base

Defined in:
lib/social_stream/toolbar_config/base.rb

Instance Method Summary collapse

Instance Method Details

#home_toolbar_itemsObject

Base toolbar items



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
# File 'lib/social_stream/toolbar_config/base.rb', line 5

def home_toolbar_items
  Array.new.tap do |items|
    #Contacts
    items << {
      :key => :contacts,
      :name => image_tag("btn/btn_friend.png")+t('contact.other'),
      :url => "#",
      :options => {:link => {:id => "contacts_menu"}},
      :items => [
        {:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.current'), :url => contacts_path},
        {:key => :contacts_graph, :name => image_tag("btn/btn_friend.png")+t('contact.graph.one'), :url => ties_path},
        {:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.pending.other'), :url => pending_contacts_path},
        {:key => :invitations, :name => image_tag("btn/btn_invitation.png")+t('invitation.toolbar'), :url => new_invitation_path}
      ]
    }

    # Groups
    items << {
      :key  => :groups,
      :name => image_tag("btn/btn_group.png") + t('group.other'),
      :url  => '#',
      :options => { :link => { :id => "groups_menu" } },
      :items => [
        {:key => :new_group ,:name => image_tag("btn/btn_group.png")+t('group.new.action'),:url => new_group_path}
      ]
    }
  end
end

#messages_toolbar_itemsObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/social_stream/toolbar_config/base.rb', line 71

def messages_toolbar_items
  Array.new.tap do |items|
  # Messages
    items << { :key => :message_new,
      :name => image_tag("btn/message_new.png")+ t('message.new'),
      :url => new_message_path,
      :options => {:link =>{:remote=> false}}}
    items << { :key => :message_inbox,
      :name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
      :url => conversations_path,
      :options => {:link =>{:remote=> false}}}
    items << { :key => :message_sentbox,
      :name => image_tag("btn/message_sentbox.png")+t('message.sentbox'),
      :url => conversations_path(:box => :sentbox),
      :options => {:link =>{:remote=> false}}}
    items << { :key => :message_trash,
      :name => image_tag("btn/message_trash.png")+t('message.trash'),
      :url => conversations_path(:box => :trash)}
  end
end

#profile_toolbar_items(subject = current_subject) ⇒ Object

Builds the default profile toolbar items



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/social_stream/toolbar_config/base.rb', line 35

def profile_toolbar_items(subject = current_subject)
  Array.new.tap do |items|
  #Information button
    items << {
      :key => :subject_info,
      :name => image_tag("btn/btn_edit.png")+t('menu.information'),
      :url => [subject, :profile]
    }

    if subject != current_subject
      #Like button
      items << {
        :key => :like_button,
        :name => link_like_params(subject)[0],
        :url => link_like_params(subject)[1],
        :options => {:link => link_like_params(subject)[2]}
      }

      if user_signed_in?
        #Relation button
        items << {
          :key => :subject_relation,
          :name => image_tag("btn/btn_friend.png") + current_subject.contact_to!(subject).status,
          :url => edit_contact_path(current_subject.contact_to!(subject))
        }

        #Send message button
        items << {:key => :send_message,
          :name => image_tag("btn/btn_send.png")+t('message.send'),
          :url => new_message_path(:receiver => subject.slug)
        }
      end
    end
  end
end