social_stream 0.23.4 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/base/app/assets/images/flags/pt.png +0 -0
  2. data/base/app/assets/javascripts/social_stream.toolbar.js +41 -0
  3. data/base/app/assets/stylesheets/settings.css +1 -0
  4. data/base/app/controllers/activity_actions_controller.rb +44 -0
  5. data/base/app/controllers/followers_controller.rb +39 -0
  6. data/base/app/helpers/activities_helper.rb +10 -10
  7. data/base/app/helpers/activity_actions_helper.rb +35 -0
  8. data/base/app/helpers/contacts_helper.rb +1 -1
  9. data/base/app/helpers/followers_helper.rb +5 -0
  10. data/base/app/helpers/toolbar_helper.rb +55 -68
  11. data/base/app/models/activity_action.rb +28 -0
  12. data/base/app/models/activity_object.rb +11 -2
  13. data/base/app/models/actor.rb +23 -33
  14. data/base/app/models/contact.rb +32 -43
  15. data/base/app/models/group.rb +2 -6
  16. data/base/app/models/relation.rb +1 -1
  17. data/base/app/models/relation/follow.rb +14 -0
  18. data/base/app/models/tie.rb +30 -30
  19. data/base/app/models/user.rb +8 -0
  20. data/base/app/views/activities/_options.html.erb +0 -1
  21. data/base/app/views/activity_actions/_follow_form.html.erb +10 -0
  22. data/base/app/views/activity_actions/_follow_sentence.html.erb +3 -0
  23. data/base/app/views/activity_actions/_update_form.js.erb +2 -0
  24. data/base/app/views/activity_actions/create.js.erb +1 -0
  25. data/base/app/views/activity_actions/update.js.erb +1 -0
  26. data/base/app/views/avatars/index.html.erb +1 -1
  27. data/base/app/views/cheesecake/index.html.erb +1 -1
  28. data/base/app/views/contacts/{_link.html.erb → _link_custom.html.erb} +0 -0
  29. data/base/app/views/contacts/_link_follow.html.erb +12 -0
  30. data/base/app/views/contacts/edit.html.erb +1 -1
  31. data/base/app/views/contacts/index.html.erb +1 -1
  32. data/base/app/views/contacts/index.js.erb +1 -1
  33. data/base/app/views/contacts/new.html.erb +1 -1
  34. data/base/app/views/conversations/index.html.erb +1 -1
  35. data/base/app/views/conversations/index.js.erb +1 -1
  36. data/base/app/views/conversations/show.html.erb +1 -1
  37. data/base/app/views/conversations/show.js.erb +1 -1
  38. data/base/app/views/devise/registrations/edit.html.erb +1 -1
  39. data/base/app/views/followers/destroy.js.erb +1 -0
  40. data/base/app/views/followers/index.html.erb +5 -0
  41. data/base/app/views/followers/update.js.erb +1 -0
  42. data/base/app/views/groups/_show.html.erb +1 -1
  43. data/base/app/views/groups/new.html.erb +1 -1
  44. data/base/app/views/layouts/_header_dropdown_menu.html.erb +5 -3
  45. data/base/app/views/messages/new.html.erb +1 -1
  46. data/base/app/views/messages/new.js.erb +1 -1
  47. data/base/app/views/objects/_show.html.erb +1 -1
  48. data/base/app/views/profiles/edit.html.erb +1 -1
  49. data/base/app/views/profiles/show.html.erb +1 -1
  50. data/base/app/views/relation/customs/index.html.erb +1 -1
  51. data/base/app/views/settings/index.html.erb +1 -1
  52. data/base/app/views/settings/index.js.erb +1 -0
  53. data/base/app/views/ties/index.html.erb +1 -1
  54. data/base/app/views/toolbar/_logo.html.erb +0 -7
  55. data/base/app/views/users/_show.html.erb +1 -1
  56. data/base/config/locales/en.yml +16 -6
  57. data/base/config/locales/es.yml +15 -6
  58. data/base/config/locales/pt.yml +507 -0
  59. data/base/config/locales/rails.pt.yml +192 -0
  60. data/base/config/routes.rb +20 -7
  61. data/base/db/migrate/20120316093946_create_activity_actions.rb +15 -0
  62. data/base/db/migrate/20120316113728_activity_action_follow.rb +23 -0
  63. data/base/lib/generators/social_stream/base/install_generator.rb +0 -4
  64. data/base/lib/generators/social_stream/base/templates/initializer.rb +7 -0
  65. data/base/lib/inherited_resources/social_stream.rb +18 -0
  66. data/base/lib/rails/social_stream.rb +23 -0
  67. data/base/lib/social_stream-base.rb +7 -3
  68. data/base/lib/social_stream/base/dependencies.rb +3 -2
  69. data/base/lib/social_stream/base/engine.rb +6 -6
  70. data/base/lib/social_stream/base/version.rb +1 -1
  71. data/base/lib/social_stream/models/channeled.rb +8 -0
  72. data/base/lib/social_stream/models/object.rb +1 -3
  73. data/base/lib/social_stream/models/subtype.rb +31 -25
  74. data/base/lib/social_stream/models/supertype.rb +54 -19
  75. data/base/lib/social_stream/views/toolbar/base.rb +143 -0
  76. data/base/lib/tasks/db/populate.rake +1 -1
  77. data/base/social_stream-base.gemspec +1 -3
  78. data/base/spec/dummy/config/initializers/social_stream.rb +7 -0
  79. data/base/spec/models/activity_action_spec.rb +26 -0
  80. data/base/spec/models/tie_spec.rb +2 -2
  81. data/documents/app/views/common_documents/_headers.html.erb +1 -1
  82. data/documents/lib/social_stream-documents.rb +4 -2
  83. data/documents/lib/social_stream/documents/engine.rb +3 -3
  84. data/documents/lib/social_stream/documents/version.rb +1 -1
  85. data/documents/lib/social_stream/views/toolbar/documents.rb +28 -0
  86. data/documents/social_stream-documents.gemspec +1 -1
  87. data/events/app/assets/javascripts/social_stream.event.js +33 -0
  88. data/events/app/assets/stylesheets/events.css.scss +37 -0
  89. data/events/app/views/events/_event.html.erb +3 -44
  90. data/events/app/views/events/_event_date.html.erb +20 -0
  91. data/events/app/views/events/_event_date_sidebar.html.erb +14 -0
  92. data/events/app/views/events/_event_details.html.erb +21 -0
  93. data/events/app/views/events/_event_poster.html.erb +9 -0
  94. data/events/app/views/events/_event_sidebar.html.erb +10 -0
  95. data/events/app/views/events/index.html.erb +1 -1
  96. data/events/app/views/events/index.js.erb +1 -1
  97. data/events/config/locales/en.yml +6 -0
  98. data/events/config/locales/es.yml +7 -0
  99. data/events/lib/social_stream/events/version.rb +1 -1
  100. data/events/social_stream-events.gemspec +2 -2
  101. data/lib/social_stream/version.rb +1 -1
  102. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  103. data/linkser/social_stream-linkser.gemspec +1 -1
  104. data/presence/app/assets/images/games/sfighter/abobo/abobo.png +0 -0
  105. data/presence/app/assets/images/games/sfighter/abobo/abobo_block_81x130x1.png +0 -0
  106. data/presence/app/assets/images/games/sfighter/abobo/abobo_die_156x119x1.png +0 -0
  107. data/presence/app/assets/images/games/sfighter/abobo/abobo_hit_108x120x3.png +0 -0
  108. data/presence/app/assets/images/games/sfighter/abobo/abobo_idle_100x121x3.png +0 -0
  109. data/presence/app/assets/images/games/sfighter/abobo/abobo_kick_137x130x2.png +0 -0
  110. data/presence/app/assets/images/games/sfighter/abobo/abobo_punch_131x170x4.png +0 -0
  111. data/presence/app/assets/images/games/sfighter/abobo/abobo_walk_backward_94x126x6.png +0 -0
  112. data/presence/app/assets/images/games/sfighter/abobo/abobo_walk_forward_94x126x6.png +0 -0
  113. data/presence/app/assets/images/games/sfighter/cvs/cvs_block_69x99x2.png +0 -0
  114. data/presence/app/assets/images/games/sfighter/cvs/cvs_die_150x110x1.png +0 -0
  115. data/presence/app/assets/images/games/sfighter/cvs/cvs_hit_59x103x1.png +0 -0
  116. data/presence/app/assets/images/games/sfighter/cvs/cvs_idle_59x106x6.png +0 -0
  117. data/presence/app/assets/images/games/sfighter/cvs/cvs_kick_156x106x9.png +0 -0
  118. data/presence/app/assets/images/games/sfighter/cvs/cvs_punch_120x104x6.png +0 -0
  119. data/presence/app/assets/images/games/sfighter/cvs/cvs_walk_backward_58x106x5.png +0 -0
  120. data/presence/app/assets/images/games/sfighter/cvs/cvs_walk_forward_58x106x5.png +0 -0
  121. data/presence/app/assets/images/games/sfighter/stage/background1.png +0 -0
  122. data/presence/app/assets/images/games/sfighter/stage/background2.png +0 -0
  123. data/presence/app/assets/images/games/sfighter/stage/background3.png +0 -0
  124. data/presence/app/assets/images/games/sfighter/stage/foreground.png +0 -0
  125. data/presence/app/assets/images/games/sfighter/stage/ground.png +0 -0
  126. data/presence/app/assets/images/games/sfighter/thumbnail.png +0 -0
  127. data/presence/app/assets/images/games/ter/classic_circle.png +0 -0
  128. data/presence/app/assets/images/games/ter/classic_thumbnail.png +0 -0
  129. data/presence/app/assets/images/games/ter/modern_thumbnail.png +0 -0
  130. data/presence/app/assets/images/webcam.png +0 -0
  131. data/presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js +2 -2
  132. data/presence/app/assets/javascripts/presence_XmppClient.js.erb +3 -1
  133. data/presence/app/assets/javascripts/presence_game.js.erb +13 -6
  134. data/presence/app/assets/javascripts/presence_game_comunication.js.erb +83 -13
  135. data/presence/app/assets/javascripts/presence_game_factory.js.erb +47 -0
  136. data/presence/app/assets/javascripts/presence_game_interface.js.erb +143 -53
  137. data/presence/app/assets/javascripts/presence_game_sfighter.js.erb +583 -0
  138. data/presence/app/assets/javascripts/presence_game_ter.js.erb +20 -9
  139. data/presence/app/assets/javascripts/presence_uiManager.js.erb +0 -2
  140. data/presence/app/assets/javascripts/presence_utilities.js +1 -1
  141. data/presence/app/assets/javascripts/presence_videochat.js.erb +5 -0
  142. data/presence/app/assets/javascripts/social_stream-presence.js +1 -0
  143. data/presence/app/assets/stylesheets/chat.css.scss +59 -6
  144. data/presence/config/locales/en.yml +1 -1
  145. data/presence/config/locales/es.yml +1 -1
  146. data/presence/lib/social_stream-presence.rb +4 -0
  147. data/presence/lib/social_stream/presence/engine.rb +6 -0
  148. data/presence/lib/social_stream/presence/version.rb +1 -1
  149. data/presence/lib/social_stream/views/toolbar/presence.rb +28 -0
  150. data/presence/social_stream-presence.gemspec +1 -1
  151. data/social_stream.gemspec +5 -5
  152. metadata +92 -41
  153. data/base/app/assets/javascripts/toolbar.js +0 -22
  154. data/base/app/views/layouts/_settings.html.erb +0 -18
  155. data/base/app/views/toolbar/_home.html.erb +0 -15
  156. data/base/app/views/toolbar/_messages.html.erb +0 -15
  157. data/base/app/views/toolbar/_profile.html.erb +0 -28
  158. data/base/lib/generators/social_stream/base/templates/navigation.rb +0 -4
  159. data/base/lib/social_stream/toolbar_config/base.rb +0 -94
  160. data/documents/lib/social_stream/toolbar_config/documents.rb +0 -27
  161. data/events/lib/social_stream/toolbar_config/events.rb +0 -22
@@ -1,5 +1,5 @@
1
- # An {Actor} represents a social entity. This includes individuals, but also groups, departments,
2
- # organizations even nations or states.
1
+ # An {Actor} represents a social entity. This means {User individuals},
2
+ # but also {Group groups}, departments, organizations even nations or states.
3
3
  #
4
4
  # Actors are the nodes of a social network. Two actors are linked by {Tie Ties}. The
5
5
  # type of a {Tie} is a {Relation}. Each actor can define and customize their relations own
@@ -7,11 +7,15 @@
7
7
  #
8
8
  # Every {Actor} has an Avatar, a {Profile} with personal o group information, contact data, etc.
9
9
  #
10
+ # {Actor Actors} perform {ActivityAction actions} (like, suscribe, etc.) on
11
+ # {ActivityObject activity objects} ({Post posts}, {Comment commments}, pictures, events..)
12
+ #
10
13
  # = Actor subtypes
11
14
  # An actor subtype is called a {SocialStream::Models::Subject Subject}.
12
- # {SocialStream} provides two actor subtypes, {User} and {Group}, but the
15
+ # {SocialStream::Base} provides two actor subtypes, {User} and {Group}, but the
13
16
  # application developer can define as many actor subtypes as required.
14
- # Actor subtypes are added to +config/initializers/social_stream.rb+
17
+ # Besides including the {SocialStream::Models::Subject} module, Actor subtypes
18
+ # must added to +config/initializers/social_stream.rb+
15
19
  #
16
20
  #
17
21
  class Actor < ActiveRecord::Base
@@ -75,6 +79,10 @@ class Actor < ActiveRecord::Base
75
79
  :foreign_key => :owner_id,
76
80
  :dependent => :destroy
77
81
 
82
+ has_many :sent_actions,
83
+ :class_name => "ActivityAction",
84
+ :dependent => :destroy
85
+
78
86
  scope :alphabetic, order('actors.name')
79
87
 
80
88
  scope :letter, lambda { |param|
@@ -117,35 +125,6 @@ class Actor < ActiveRecord::Base
117
125
  after_create :save_or_create_profile
118
126
 
119
127
  class << self
120
- # Get actor's id from an object, if possible
121
- def normalize_id(a)
122
- case a
123
- when Integer
124
- a
125
- when Array
126
- a.map{ |e| normalize_id(e) }
127
- else
128
- Actor.normalize(a).id
129
- end
130
- end
131
- # Get actor from object, if possible
132
- def normalize(a)
133
- case a
134
- when Actor
135
- a
136
- when Integer
137
- Actor.find a
138
- when Array
139
- a.map{ |e| Actor.normalize(e) }
140
- else
141
- begin
142
- a.actor
143
- rescue
144
- raise "Unable to normalize actor #{ a.inspect }"
145
- end
146
- end
147
- end
148
-
149
128
  def find_by_webfinger!(link)
150
129
  link =~ /(acct:)?(.*)@/
151
130
 
@@ -318,6 +297,17 @@ class Actor < ActiveRecord::Base
318
297
  Channel.find_or_create_by_author_id_and_user_author_id_and_owner_id id, id, id
319
298
  end
320
299
 
300
+ # Return the {ActivityAction} model to an {ActivityObject}
301
+ def action_to(activity_object)
302
+ sent_actions.received_by(activity_object).first
303
+ end
304
+
305
+ # Return the {ActivityAction} model to an {ActivityObject}. Create it if it does not exist
306
+ def action_to!(activity_object)
307
+ action_to(activity_object) ||
308
+ sent_actions.create!(:activity_object => ActivityObject.normalize(activity_object))
309
+ end
310
+
321
311
  def sent_active_contact_ids
322
312
  @sent_active_contact_ids ||=
323
313
  load_sent_active_contact_ids
@@ -3,7 +3,17 @@
3
3
  #
4
4
  # {Contact Contacts} are created at convenience (in the case of {Actor#suggestions suggestions},
5
5
  # for instance), and they do not mean that there is a real link between those two
6
- # {SocialStream::Models::Subject Subjects}. Link existance is stored as {Tie Ties}.
6
+ # {SocialStream::Models::Subject Subjects}. Link existance is stored as a {Tie}.
7
+ # When Alice adds Bob as contact, a new {Tie} is created with the {Contact} from Alice to
8
+ # Bob and the {Relation} that Alice chose.
9
+ #
10
+ # == Inverse Contacts
11
+ #
12
+ # Alice has a {Contact} to Bob. The inverse is the {Contact} from {Bob} to {Alice}.
13
+ # Inverse contacts are used to check if contacts are replied, for instance, if Bob added
14
+ # Alice as contact after she did so.
15
+ #
16
+ # Again, the Contact from Bob to Alice must have positive {Tie ties} to be active.
7
17
  #
8
18
  class Contact < ActiveRecord::Base
9
19
  # Send a message when this contact is created or updated
@@ -22,7 +32,8 @@ class Contact < ActiveRecord::Base
22
32
  :before_add => :set_user_author
23
33
 
24
34
  has_many :relations,
25
- :through => :ties
35
+ :through => :ties,
36
+ :after_remove => :unset_follow_action
26
37
 
27
38
  scope :sent_by, lambda { |a|
28
39
  where(:sender_id => Actor.normalize_id(a))
@@ -112,18 +123,6 @@ class Contact < ActiveRecord::Base
112
123
  replied? ? "make-friend" : "follow"
113
124
  end
114
125
 
115
- # has_many collection=objects method does not trigger destroy callbacks,
116
- # so follower_count will not be updated
117
- #
118
- # We need to update that status here
119
- #
120
- # FIXME: use :after_remove callback
121
- # http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Association+callbacks
122
- def relation_ids=(ids)
123
- remove_follower(ids)
124
- association(:relations).ids_writer(ids)
125
- end
126
-
127
126
  # Record who creates ties in behalf of a group or organization
128
127
  #
129
128
  # Defaults to the sender actor, if it is a user
@@ -137,6 +136,13 @@ class Contact < ActiveRecord::Base
137
136
  @user_author = (subject.nil? ? nil : Actor.normalize(subject))
138
137
  end
139
138
 
139
+ # The sender of this {Contact} has establised positive sent to the receiver
140
+ #
141
+ # That means that there exists at least one {Tie} with a positive relation within them
142
+ def sent?
143
+ ties_count > 0 && relations.where(:type => Relation.positive_names).any?
144
+ end
145
+
140
146
  # Is this {Contact} +new+ or +edit+ for {SocialStream::Models::Subject subject} ?
141
147
  #
142
148
  # action is +new+ when, despite of being created, it has not {Tie ties} or it has a {Tie} with a
@@ -146,11 +152,7 @@ class Contact < ActiveRecord::Base
146
152
  # a {Relation::Public public relation}
147
153
  #
148
154
  def action
149
- if ties_count > 0 && relations.where(:type => Relation.positive_names).any?
150
- 'edit'
151
- else
152
- replied? ? 'reply' : 'new'
153
- end
155
+ sent? ? 'edit' : ( replied? ? 'reply' : 'new' )
154
156
  end
155
157
 
156
158
  def status
@@ -200,31 +202,18 @@ class Contact < ActiveRecord::Base
200
202
  tie.contact.user_author = @user_author
201
203
  end
202
204
 
203
- def remove_follower(ids)
204
- # There was no follower
205
- return if relation_ids.blank?
206
-
207
- ids = ids.map(&:to_i)
208
-
209
- return if ids.sort == relation_ids.sort
210
-
211
- following = Relation.
212
- where(:id => relation_ids).
213
- joins(:permissions).
214
- merge(Permission.follow).
215
- any?
216
-
217
- if following
218
- will_follow = Relation.
219
- where(:id => ids).
220
- joins(:permissions).
221
- merge(Permission.follow).
222
- any?
205
+ # after_remove callback
206
+ #
207
+ # has_many collection=objects method does not trigger destroy callbacks,
208
+ # so action#follow and follower_count will not be updated
209
+ #
210
+ # We need to update that status here
211
+ #
212
+ def unset_follow_action(relation)
213
+ tie = Tie.new :contact => self,
214
+ :relation => relation
223
215
 
224
- if !will_follow
225
- receiver.decrement!(:follower_count)
226
- end
227
- end
216
+ tie.unset_follow_action
228
217
  end
229
218
 
230
219
  # Send a message to the contact receiver
@@ -10,11 +10,7 @@ class Group < ActiveRecord::Base
10
10
  def profile!
11
11
  actor!.profile || actor!.build_profile
12
12
  end
13
-
14
- def followers
15
- contact_subjects(:subject_type => :user, :direction => :received)
16
- end
17
-
13
+
18
14
  def recent_groups
19
15
  contact_subjects(:type => :group, :direction => :sent) do |q|
20
16
  q.select("contacts.created_at").
@@ -54,4 +50,4 @@ class Group < ActiveRecord::Base
54
50
  end
55
51
  end
56
52
 
57
- ActiveSupport.run_load_hooks(:group, Group)
53
+ ActiveSupport.run_load_hooks(:group, Group)
@@ -41,7 +41,7 @@
41
41
  # It sets the {Audience} that has access to it, and the {Permission Permissions} that rule that access.
42
42
  #
43
43
  class Relation < ActiveRecord::Base
44
- Positive = %w{ custom public }
44
+ Positive = %w{ custom public follow }
45
45
  Negative = %w{ reject }
46
46
 
47
47
  belongs_to :actor
@@ -0,0 +1,14 @@
1
+ # This relation model implements Twitter-like relations:
2
+ # Users just have followers and followings.
3
+ #
4
+ # Use this model setting <tt>config.relation_model = :follow</tt> in your
5
+ # <tt>config/initializers/social_stream.rb</tt>
6
+ class Relation::Follow < Relation::Single
7
+ class << self
8
+ def instance
9
+ first ||
10
+ create(:permissions => Array(Permission.find_or_create_by_action('follow')))
11
+ end
12
+ end
13
+ end
14
+
@@ -64,8 +64,8 @@ class Tie < ActiveRecord::Base
64
64
  validate :relation_belongs_to_sender
65
65
 
66
66
  after_create :create_activity
67
- after_create :increment_follower_count
68
- after_destroy :decrement_follower_count
67
+ after_create :set_follow_action
68
+ after_destroy :unset_follow_action
69
69
 
70
70
  def relation_name
71
71
  relation.try(:name)
@@ -94,43 +94,26 @@ class Tie < ActiveRecord::Base
94
94
  positive? && positive_replied?
95
95
  end
96
96
 
97
- private
98
-
99
- # before_create callback
100
- #
101
- # Create contact activity if this is the first tie
102
- def create_activity
103
- return if contact.reload.ties_count != 1 || relation.is_a?(Relation::Reject)
104
-
105
- Activity.create! :author => contact.sender,
106
- :user_author => contact.user_author,
107
- :owner => contact.receiver,
108
- :relation_ids => contact.relation_ids,
109
- :activity_verb => ActivityVerb[contact.verb]
110
- end
111
-
112
97
  # after_create callback
113
98
  #
114
- # Increment the {Actor}'s follower_count
115
- def increment_follower_count
99
+ # Create the {Actor}'s follower_count
100
+ def set_follow_action
116
101
  return if contact.reflexive? ||
117
102
  !relation.permissions.include?(Permission.follow.first)
118
103
 
119
- # Because we allow several ties from the same sender to the same receiver,
120
- # we check the receiver does not already have a follower tie from this sender
121
- return if Tie.sent_by(sender).
122
- received_by(receiver).
123
- with_permissions('follow', nil).
124
- where("ties.id != ?", id).
125
- present?
104
+ action = sender.action_to!(receiver)
105
+
106
+ return if action.follow?
126
107
 
127
- receiver.increment!(:follower_count)
108
+ action.update_attribute(:follow, true)
128
109
  end
129
110
 
130
- # after_destroy callback
111
+ # after_remove callback
131
112
  #
132
113
  # Decrement the {Actor}'s follower_count
133
- def decrement_follower_count
114
+ #
115
+ # This method needs to be public to be call from {Contact}'s after_remove callback
116
+ def unset_follow_action
134
117
  return if contact.reflexive? ||
135
118
  !relation.permissions.include?(Permission.follow.first)
136
119
 
@@ -141,7 +124,24 @@ class Tie < ActiveRecord::Base
141
124
  with_permissions('follow', nil).
142
125
  present?
143
126
 
144
- receiver.decrement!(:follower_count)
127
+ action = sender.action_to!(receiver)
128
+
129
+ action.update_attribute(:follow, false)
130
+ end
131
+
132
+ private
133
+
134
+ # before_create callback
135
+ #
136
+ # Create contact activity if this is the first tie
137
+ def create_activity
138
+ return if contact.reload.ties_count != 1 || relation.is_a?(Relation::Reject)
139
+
140
+ Activity.create! :author => contact.sender,
141
+ :user_author => contact.user_author,
142
+ :owner => contact.receiver,
143
+ :relation_ids => contact.relation_ids,
144
+ :activity_verb => ActivityVerb[contact.verb]
145
145
  end
146
146
 
147
147
  def relation_belongs_to_sender
@@ -1,5 +1,13 @@
1
1
  require 'devise/orm/active_record'
2
2
 
3
+ # Every social network must have users, and a social network builder couldn't be the exception.
4
+ #
5
+ # Social Stream uses the awesome gem {Devise https://github.com/plataformatec/devise}
6
+ # for managing authentication
7
+ #
8
+ # Almost all the logic of the interaction between {User} and the rest of classes in Social Stream
9
+ # is done through {SocialStream::Models::Subject} and {Actor}
10
+ #
3
11
  class User < ActiveRecord::Base
4
12
  include SocialStream::Models::Subject
5
13
 
@@ -23,5 +23,4 @@
23
23
  :remote => true %>
24
24
  </div>
25
25
  <% end %>
26
- </ul>
27
26
  </div>
@@ -0,0 +1,10 @@
1
+ <%= form_for toggle_follow_action(activity_object),
2
+ :html => { :class => "follow_form-#{ dom_id activity_object }" },
3
+ :remote => true do |f| %>
4
+ <% if f.object.new_record? %>
5
+ <%= f.hidden_field :activity_object_id %>
6
+ <% end %>
7
+ <%= f.hidden_field :follow %>
8
+
9
+ <%= f.submit t("#{ activity_object.object_type.underscore }.activity_action.#{ f.object.follow ? 'follow' : 'unfollow' }", :default => "activity_action.#{ f.object.follow ? 'follow' : 'unfollow' }") %>
10
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="follow_sentence-<%= dom_id activity_object %>">
2
+ <%= followers_sentence activity_object %>
3
+ </div>
@@ -0,0 +1,2 @@
1
+ $('.follow_form-<%= dom_id(activity_object) %>').replaceWith("<%= escape_javascript render(:partial => 'activity_actions/follow_form', :locals => { :activity_object => activity_object }) %>");
2
+ $('.follow_sentence-<%= dom_id(activity_object) %>').replaceWith("<%= escape_javascript render(:partial => 'activity_actions/follow_sentence', :locals => { :activity_object => activity_object }) %>");
@@ -0,0 +1 @@
1
+ <%= render :partial => 'update_form', :locals => { :activity_object => @activity_object } %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'update_form', :locals => { :activity_object => @activity_action.activity_object } %>
@@ -1,4 +1,4 @@
1
- <% toolbar :profile => current_subject %>
1
+ <% toolbar :profile, :subject => current_subject %>
2
2
 
3
3
  <% content_for :title do%>
4
4
  <%= current_subject.name %>
@@ -2,7 +2,7 @@
2
2
  <%= t('contact.other')%>
3
3
  <%end%>
4
4
 
5
- <% toolbar :option => :contacts %>
5
+ <% toolbar :home, :option => :contacts %>
6
6
 
7
7
  <% location link_to(t("contact.other"),contacts_path) %>
8
8
  <div id="cheesecake">
@@ -0,0 +1,12 @@
1
+ <div class="<%= follow_link_class contact %>">
2
+ <% if contact.sent? %>
3
+ <%= t 'contact.following' %>
4
+ <%= form_tag follower_path(contact), :method => :delete, :remote => true do |f| %>
5
+ <%= submit_tag t('contact.unfollow') %>
6
+ <% end %>
7
+ <% else %>
8
+ <%= form_tag follower_path(contact), :method => :put, :remote => true do |f| %>
9
+ <%= submit_tag t('contact.follow') %>
10
+ <% end %>
11
+ <% end %>
12
+ </div>
@@ -1,4 +1,4 @@
1
- <% toolbar :profile => @contact.receiver_subject, :option => 'contacts' %>
1
+ <% toolbar :profile, :subject => @contact.receiver_subject, :option => 'contacts' %>
2
2
 
3
3
  <% location link_to(t("contact.#{ @contact.action }.title", :name => @contact.receiver.name),
4
4
  edit_contact_path(@contact.to_param)) %>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <% sidebar %>
6
6
 
7
- <% toolbar :option => :contacts %>
7
+ <% toolbar :home, :option => :contacts %>
8
8
 
9
9
  <div id="my_conferences">
10
10
  <div id="contacts" class="block">
@@ -1,3 +1,3 @@
1
1
  $('#list_contacts_ajax').html("<%= escape_javascript(render :partial => "contacts/index") %>");
2
2
 
3
- <% toolbar :option => :contacts %>
3
+ <% toolbar :home, :option => :contacts %>