social_stream-base 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,4 +206,8 @@ textarea.new_contact_text_area{ width:100%; height: 100px; color: #2A3890;}
206
206
 
207
207
  .activities_title_header.selected{
208
208
  border: 2px solid #46B9E8;
209
- }
209
+ }
210
+
211
+ .more_pending{
212
+ text-align: center;
213
+ }
@@ -3,16 +3,24 @@ class ContactsController < ApplicationController
3
3
 
4
4
  def index
5
5
  @contacts =
6
- current_subject.
7
- contact_subjects(:direction => :sent, :relations => params[:relation]){ |q|
8
- q.alphabetic.
9
- letter(params[:letter]).
10
- search(params[:search])
11
- }
6
+ Contact.sent_by(current_subject).
7
+ joins(:receiver).merge(Actor.alphabetic).
8
+ merge(Actor.letter(params[:letter])).
9
+ merge(Actor.search(params[:search]))
10
+
11
+ if params[:pending].present?
12
+ @contacts =
13
+ Contact.received_by(current_subject).
14
+ joins(:sender).merge(Actor.alphabetic).
15
+ merge(Actor.letter(params[:letter])).
16
+ merge(Actor.search(params[:search])).
17
+ pending.
18
+ not_reflexive
19
+ end
12
20
 
13
21
  respond_to do |format|
14
- format.html { @contacts = Kaminari.paginate_array(@contacts).page(params[:page]).per(10) }
15
- format.js { @contacts = Kaminari.paginate_array(@contacts).page(params[:page]).per(10) }
22
+ format.html { @contacts = @contacts.page(params[:page]).per(10) }
23
+ format.js { @contacts = @contacts.page(params[:page]).per(10) }
16
24
  format.json { render :text => @contacts.map{ |c| { 'key' => c.actor_id.to_s, 'value' => self.class.helpers.truncate_name(c.name) } }.to_json }
17
25
  end
18
26
  end
@@ -57,7 +57,7 @@ class Contact < ActiveRecord::Base
57
57
  validates_uniqueness_of :receiver_id, :scope => :sender_id
58
58
 
59
59
  after_create :set_inverse
60
- after_create :send_message
60
+ after_save :send_message
61
61
 
62
62
  def sender_subject
63
63
  sender.try(:subject)
@@ -146,9 +146,9 @@ class Contact < ActiveRecord::Base
146
146
 
147
147
  # Send a message to the contact receiver
148
148
  def send_message
149
- if message.present?
150
- sender.send_message(receiver, message, I18n.t("activity.verb.#{ verb }.#{ receiver.subject_type }.message", :name => sender.name))
151
- end
149
+ return if message.blank?
150
+
151
+ sender.send_message(receiver, message, I18n.t("activity.verb.#{ verb }.#{ receiver.subject_type }.message", :name => sender.name))
152
152
  end
153
153
 
154
154
  def set_inverse
data/app/models/tie.rb CHANGED
@@ -88,7 +88,7 @@ class Tie < ActiveRecord::Base
88
88
  #
89
89
  # Create contact activity if this is the first tie
90
90
  def create_activity
91
- return unless contact.ties_count == 1
91
+ return if contact.reload.ties_count != 1
92
92
 
93
93
  Activity.create! :contact => contact,
94
94
  :relation_ids => contact.relation_ids,
@@ -1,7 +1,11 @@
1
1
  <% cont=0; %>
2
2
 
3
3
  <% @contacts.each do |contact| %>
4
-
4
+ <% if params[:pending].present? %>
5
+ <% contact = contact.sender.subject %>
6
+ <% else %>
7
+ <% contact = contact.receiver.subject %>
8
+ <% end %>
5
9
  <% if (cont%2) == 0 %>
6
10
  <% cont+=1; %>
7
11
  <div class="row">
@@ -2,10 +2,17 @@
2
2
  <div class="block">
3
3
  <div class="header">
4
4
  <%= image_tag('btn/btn_notifications.png', :class => "header_icon") %>
5
- <div class="header_text"><%= t 'contact.pending.other' %></div>
5
+ <div class="header_text">
6
+ <%= t 'contact.pending.other' %>
7
+ </div>
6
8
  </div>
7
9
  <div class="content">
8
- <%= render current_subject.pending_contacts %>
10
+ <%= render current_subject.pending_contacts.shuffle.first(2) %>
11
+ <div class="row more_pending">
12
+ <%= link_to t('contact.pending.all_n', :count => current_subject.pending_contacts.size), contacts_path(:pending=>true)%>
13
+ </div>
14
+ <div class="space_center">
15
+ </div>
9
16
  </div>
10
17
  </div>
11
18
  <% end -%>
@@ -6,6 +6,10 @@
6
6
  <%= javascript_include_tag 'jquery.ba-url','ajax.paginate' %>
7
7
  <% end %>
8
8
 
9
+ <% content_for :sidebar do %>
10
+ <%= render :partial => 'home/sidebar' %>
11
+ <% end %>
12
+
9
13
  <% toolbar :option => :contacts %>
10
14
 
11
15
  <div id="my_conferences">
@@ -11,10 +11,6 @@
11
11
  <div class="space_center">
12
12
  </div>
13
13
 
14
- <% if SocialStream.activity_forms.include? :document %>
15
- <%= render :partial => '/documents/mediawall' %>
16
- <% end %>
17
-
18
14
  <% if current_subject.respond_to?(:recent_groups) %>
19
15
  <div id="my_groups">
20
16
  <%= render :partial => "groups" %>
@@ -73,6 +73,7 @@ en:
73
73
  confirm_delete: "Delete comment?"
74
74
  contact:
75
75
  all_n: "All contacts (%{count})"
76
+ addressbook: "Addressbook"
76
77
  edit:
77
78
  title: "Edit contact to %{name}"
78
79
  submit: "Edit Contact"
@@ -86,6 +87,7 @@ en:
86
87
  pending:
87
88
  other: "Pending requests"
88
89
  all: "All"
90
+ all_n: "See all pending requests (%{count})"
89
91
  relation:
90
92
  one: "Contact type"
91
93
  new: "New type"
@@ -163,6 +165,7 @@ en:
163
165
  join_me: "Join me at SocialStream!"
164
166
  one: "Invitation"
165
167
  other: "Invitations"
168
+ toolbar: "Invite"
166
169
  success: "Your invitations have successfully been sent"
167
170
  text: "Write your own message"
168
171
  like:
@@ -44,10 +44,6 @@ class SocialStream::Base::InstallGenerator < Rails::Generators::Base #:nodoc:
44
44
  copy_file 'navigation.rb', 'config/navigation.rb'
45
45
  end
46
46
 
47
- def create_mailboxer_custom_config
48
- copy_file 'mailboxer_custom.rb', 'config/initializers/mailboxer.rb'
49
- end
50
-
51
47
  def create_migration_file
52
48
  require 'rake'
53
49
  Rails.application.load_tasks
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.6.5".freeze
3
+ VERSION = "0.6.6".freeze
4
4
  end
5
5
  end
@@ -35,6 +35,12 @@ module SocialStream
35
35
  :profile => '119x119'}
36
36
  end
37
37
  end
38
+
39
+ initializer "social_stream-base.mailboxer", :before => :load_config_initializers do
40
+ Mailboxer.setup do |config|
41
+ config.email_method = :mailboxer_email
42
+ end
43
+ end
38
44
  end
39
45
  end
40
46
  end
@@ -1,113 +1,111 @@
1
1
  module SocialStream
2
2
  module ToolbarConfig
3
3
  #Prints the default home toolbar menu
4
- def default_home_toolbar_menu
5
- items = Array.new
6
- #Notifications
7
- items << {:key => :notifications,
8
- :name => image_tag("btn/btn_notification.png")+t('notification.other')+' ('+ current_subject.mailbox.notifications.not_trashed.unread.count.to_s+')',
9
- :url => notifications_path,
10
- :options => {:link => {:id => "notifications_menu"}}}
4
+ def default_home_toolbar_menu
5
+ items = Array.new
6
+ #Notifications
7
+ items << {:key => :notifications,
8
+ :name => image_tag("btn/btn_notification.png")+t('notification.other')+' ('+ current_subject.mailbox.notifications.not_trashed.unread.count.to_s+')',
9
+ :url => notifications_path,
10
+ :options => {:link => {:id => "notifications_menu"}}}
11
11
 
12
- #Messages
13
- items << {:key => :messages,
14
- :name => image_tag("btn/new.png")+t('message.other')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
15
- :url => "#",
16
- :options => {:link => {:id => "messages_menu"}},
17
- :items => [
18
- {:key => :message_new, :name => image_tag("btn/message_new.png")+ t('message.new'), :url => new_message_path},
19
- {:key => :message_inbox, :name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
20
- :url => conversations_path, :options => {:link =>{:remote=> true}}},
21
- {:key => :message_sentbox, :name => image_tag("btn/message_sentbox.png")+t('message.sentbox'), :url => conversations_path(:box => :sentbox), :remote=> true},
22
- {:key => :message_trash, :name => image_tag("btn/message_trash.png")+t('message.trash'), :url => conversations_path(:box => :trash)}
23
- ]}
12
+ #Messages
13
+ items << {:key => :messages,
14
+ :name => image_tag("btn/new.png")+t('message.other')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
15
+ :url => "#",
16
+ :options => {:link => {:id => "messages_menu"}},
17
+ :items => [
18
+ {:key => :message_new, :name => image_tag("btn/message_new.png")+ t('message.new'), :url => new_message_path},
19
+ {:key => :message_inbox, :name => image_tag("btn/message_inbox.png")+t('message.inbox')+' (' + current_subject.mailbox.inbox(:unread => true).count.to_s + ')',
20
+ :url => conversations_path, :options => {:link =>{:remote=> true}}},
21
+ {:key => :message_sentbox, :name => image_tag("btn/message_sentbox.png")+t('message.sentbox'), :url => conversations_path(:box => :sentbox), :remote=> true},
22
+ {:key => :message_trash, :name => image_tag("btn/message_trash.png")+t('message.trash'), :url => conversations_path(:box => :trash)}
23
+ ]}
24
+
25
+ #Documents if present
26
+ if SocialStream.activity_forms.include? :document
27
+ items << {:key => :resources,
28
+ :name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+t('resource.mine'),
29
+ :url => "#",
30
+ :options => {:link => {:id => "resources_menu"}},
31
+ :items => [
32
+ {:key => :resources_documents,:name => image_tag("btn/btn_documents.png")+t('document.title'),:url => documents_path},
33
+ {:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
34
+ {:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
35
+ {:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
36
+ ]}
37
+ end
24
38
 
25
- #Documents if present
26
- if SocialStream.activity_forms.include? :document
27
- items << {:key => :resources,
28
- :name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+t('resource.mine'),
39
+ #Contacts
40
+ items << {:key => :contacts,
41
+ :name => image_tag("btn/btn_friend.png")+t('contact.other'),
29
42
  :url => "#",
30
- :options => {:link => {:id => "resources_menu"}},
43
+ :options => {:link => {:id => "contacts_menu"}},
31
44
  :items => [
32
- {:key => :resources_documents,:name => image_tag("btn/btn_documents.png")+t('document.title'),:url => documents_path},
33
- {:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
34
- {:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
35
- {:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
45
+ {:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.addresbook'), :url => contacts_path},
46
+ {:key => :invitations, :name => image_tag("btn/btn_invitation.png")+t('invitation.toolbar'), :url => new_invitation_path},
47
+ {:key => :invitations, :name => image_tag("btn/btn_friend.png")+t('contact.pending.other'), :url => contacts_path(:pending=>true)}
36
48
  ]}
37
- end
38
49
 
39
- #Contacts
40
- relation_items = [{:key => :invitations, :name => image_tag("btn/btn_invitation.png")+t('invitation.other'), :url => new_invitation_path}]
41
- current_subject.relation_customs.sort.each do |r|
42
- relation_items << {:key => r.name + "_menu",
43
- :name => image_tag("btn/btn_friend.png") + r.name,
44
- :url => contacts_path(:relation => r.id)}
45
- end
46
- items << {:key => :contacts,
47
- :name => image_tag("btn/btn_friend.png")+t('contact.other'),
48
- :url => "#",
49
- :options => {:link => {:id => "contacts_menu"}},
50
- :items => relation_items}
50
+ #Subjects
51
+ items << {:key => :groups,
52
+ :name => image_tag("btn/btn_group.png")+t('group.other'),
53
+ :url => "#",
54
+ :options => {:link => {:id => "groups_menu"}},
55
+ :items => [{:key => :new_group ,:name => image_tag("btn/btn_group.png")+t('group.new.action'),:url => new_group_path('group' => { '_founder' => current_subject.slug })}]
56
+ }
51
57
 
52
- #Subjects
53
- items << {:key => :groups,
54
- :name => image_tag("btn/btn_group.png")+t('group.other'),
55
- :url => "#",
56
- :options => {:link => {:id => "groups_menu"}},
57
- :items => [{:key => :new_group ,:name => image_tag("btn/btn_group.png")+t('group.new.action'),:url => new_group_path('group' => { '_founder' => current_subject.slug })}]
58
- }
58
+ render_items items
59
+ end
59
60
 
60
- render_items items
61
- end
61
+ #Prints the default profile toolbar menu
62
+ def default_profile_toolbar_menu(subject = current_subject)
63
+ items = Array.new
64
+ #Information button
65
+ items << {:key => :subject_info,
66
+ :name => image_tag("btn/btn_edit.png")+t('menu.information'),
67
+ :url => [subject, :profile]
68
+ }
62
69
 
63
- #Prints the default profile toolbar menu
64
- def default_profile_toolbar_menu(subject = current_subject)
65
- items = Array.new
66
- #Information button
67
- items << {:key => :subject_info,
68
- :name => image_tag("btn/btn_edit.png")+t('menu.information'),
69
- :url => [subject, :profile]
70
- }
70
+ if subject!=current_subject
71
+ #Like button
72
+ items << {:key => :like_button,
73
+ :name => link_like_params(subject)[0],
74
+ :url => link_like_params(subject)[1],
75
+ :options => {:link => link_like_params(subject)[2]}}
71
76
 
72
- if subject!=current_subject
73
- #Like button
74
- items << {:key => :like_button,
75
- :name => link_like_params(subject)[0],
76
- :url => link_like_params(subject)[1],
77
- :options => {:link => link_like_params(subject)[2]}}
78
-
79
- if user_signed_in?
80
- #Relation button
81
- items << {:key => :subject_relation,
82
- :name => image_tag("btn/btn_friend.png") + contact_status(subject),
83
- :url => edit_contact_path(current_subject.contact_to!(subject))
84
- }
85
- #Send message button
86
- items << {:key => :send_message,
87
- :name => image_tag("btn/btn_send.png")+t('message.send'),
88
- :url => new_message_path(:receiver => subject.slug)
89
- }
77
+ if user_signed_in?
78
+ #Relation button
79
+ items << {:key => :subject_relation,
80
+ :name => image_tag("btn/btn_friend.png") + contact_status(subject),
81
+ :url => edit_contact_path(current_subject.contact_to!(subject))
82
+ }
83
+ #Send message button
84
+ items << {:key => :send_message,
85
+ :name => image_tag("btn/btn_send.png")+t('message.send'),
86
+ :url => new_message_path(:receiver => subject.slug)
87
+ }
88
+ end
90
89
  end
91
- end
92
- #Documents if present
93
- if SocialStream.activity_forms.include? :document
94
- if subject == current_subject
95
- resources_label = t('resource.mine')
96
- else
97
- resources_label = t('resource.title')
90
+ #Documents if present
91
+ if SocialStream.activity_forms.include? :document
92
+ if subject == current_subject
93
+ resources_label = t('resource.mine')
94
+ else
95
+ resources_label = t('resource.title')
96
+ end
97
+ items << {:key => :resources,
98
+ :name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+resources_label,
99
+ :url => "#",
100
+ :options => {:link => {:id => "resources_menu"}},
101
+ :items => [
102
+ {:key => :resources_documents,:name => image_tag("btn/btn_documents.png")+t('document.title'),:url => documents_path},
103
+ {:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
104
+ {:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
105
+ {:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
106
+ ]}
98
107
  end
99
- items << {:key => :resources,
100
- :name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+resources_label,
101
- :url => "#",
102
- :options => {:link => {:id => "resources_menu"}},
103
- :items => [
104
- {:key => :resources_documents,:name => image_tag("btn/btn_documents.png")+t('document.title'),:url => documents_path},
105
- {:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
106
- {:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
107
- {:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
108
- ]}
108
+ render_items items
109
109
  end
110
- render_items items
111
- end
112
110
  end
113
111
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-base
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - GING - DIT - UPM
@@ -1077,7 +1077,6 @@ files:
1077
1077
  - lib/acts_as_taggable_on/social_stream.rb
1078
1078
  - lib/generators/social_stream/base/install_generator.rb
1079
1079
  - lib/generators/social_stream/base/templates/initializer.rb
1080
- - lib/generators/social_stream/base/templates/mailboxer_custom.rb
1081
1080
  - lib/generators/social_stream/base/templates/navigation.rb
1082
1081
  - lib/generators/social_stream/base/templates/relations.yml
1083
1082
  - lib/paperclip/social_stream.rb
@@ -1,13 +0,0 @@
1
- Mailboxer.setup do |config|
2
-
3
- #Configures if you applications uses or no the email sending for Notifications and Messages
4
- config.uses_emails = true
5
-
6
- #Configures the default from for the email sent for Messages and Notifications of Mailboxer
7
- config.default_from = "no-reply@mailboxer.com"
8
-
9
- #Configures the methods needed by mailboxer
10
- config.email_method = :mailboxer_email
11
- #config.name_method = :name
12
- #config.should_email_method = :should_email?
13
- end