social_stream 0.20.2 → 0.21.0

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.
Files changed (64) hide show
  1. data/base/app/assets/images/btn/permission_negative.png +0 -0
  2. data/base/app/assets/images/btn/permission_positive.png +0 -0
  3. data/base/app/assets/javascripts/activities.js.erb +2 -118
  4. data/base/app/assets/javascripts/social_stream-base.js +3 -0
  5. data/base/app/assets/javascripts/social_stream.timeline.js +42 -0
  6. data/base/app/assets/javascripts/social_stream.wall.js.erb +125 -0
  7. data/base/app/assets/stylesheets/cheesecake.css.scss +9 -1
  8. data/base/app/helpers/notifications_helper.rb +1 -5
  9. data/base/app/models/activity.rb +21 -2
  10. data/base/app/models/comment.rb +5 -0
  11. data/base/app/models/permission.rb +16 -1
  12. data/base/app/models/post.rb +5 -0
  13. data/base/app/views/activities/_new.html.erb +7 -6
  14. data/base/app/views/activities/_wall.html.erb +6 -0
  15. data/base/app/views/cheesecake/_index.html.erb +17 -0
  16. data/base/app/views/cheesecake/_sector_form.html.erb +15 -6
  17. data/base/app/views/comments/_new.html.erb +2 -2
  18. data/base/app/views/comments/create.js.erb +1 -3
  19. data/base/app/views/notifications/activities/_post.html.erb +0 -3
  20. data/base/app/views/permissions/_index.html.erb +2 -2
  21. data/base/app/views/posts/create.js.erb +1 -4
  22. data/base/config/locales/en.yml +33 -23
  23. data/base/config/locales/es.yml +53 -24
  24. data/base/db/migrate/20120208135718_group_title_and_description_in_activity_object.rb +52 -0
  25. data/base/lib/social_stream/base/version.rb +1 -1
  26. data/base/spec/factories/activity.rb +1 -1
  27. data/documents/db/migrate/20120208143721_documents_group_title_and_description_in_activity_object.rb +28 -0
  28. data/documents/lib/social_stream/documents/version.rb +1 -1
  29. data/documents/social_stream-documents.gemspec +1 -1
  30. data/documents/spec/factories/document.rb +1 -0
  31. data/documents/spec/factories/picture.rb +1 -0
  32. data/events/db/migrate/20120208143756_events_group_title_and_description_in_activity_object.rb +26 -0
  33. data/events/lib/social_stream/events/version.rb +1 -1
  34. data/events/social_stream-events.gemspec +1 -1
  35. data/lib/social_stream/version.rb +1 -1
  36. data/linkser/app/views/links/create.js.erb +1 -3
  37. data/linkser/db/migrate/20120208143739_linkser_group_title_and_description_in_activity_object.rb +30 -0
  38. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  39. data/linkser/social_stream-linkser.gemspec +1 -1
  40. data/presence/app/assets/images/black_arrow7.png +0 -0
  41. data/presence/app/assets/images/black_arrow8.png +0 -0
  42. data/presence/app/assets/images/black_arrow9.png +0 -0
  43. data/presence/app/assets/javascripts/chat_interface_manager.js.erb +191 -23
  44. data/presence/app/assets/javascripts/chat_persistence.js +15 -6
  45. data/presence/app/assets/javascripts/chat_utilities.js +13 -0
  46. data/presence/app/assets/javascripts/chat_window_manager.js +101 -20
  47. data/presence/app/assets/javascripts/social_stream-presence.js +2 -0
  48. data/presence/app/assets/javascripts/xmpp_client_management.js.erb +6 -5
  49. data/presence/app/assets/stylesheets/chat.css.scss +43 -3
  50. data/presence/app/assets/stylesheets/social_stream-presence.css +1 -0
  51. data/presence/app/helpers/xmpp_helper.rb +4 -2
  52. data/presence/app/views/chat/_contacts.html.erb +55 -42
  53. data/presence/config/locales/en.yml +4 -1
  54. data/presence/config/locales/es.yml +3 -1
  55. data/presence/db/migrate/20110928135031_add_status_column_to_user.rb +1 -1
  56. data/presence/lib/social_stream/presence/version.rb +1 -1
  57. data/presence/social_stream-presence.gemspec +1 -1
  58. data/presence/vendor/assets/javascripts/jquery.flexselect.js +265 -0
  59. data/presence/vendor/assets/javascripts/jquery.tools.tooltip.js +2 -1
  60. data/presence/vendor/assets/javascripts/liquidmetal.js +90 -0
  61. data/presence/vendor/assets/stylesheets/flexselect.css +39 -0
  62. data/social_stream.gemspec +5 -5
  63. metadata +45 -32
  64. data/base/app/views/activities/_filter.html.erb +0 -83
@@ -1,106 +1,9 @@
1
1
  //= require jquery.livequery
2
2
  //= require jquery.tipsy
3
3
  //
4
+ //= require social_stream.wall
5
+ //
4
6
  //initial state
5
- var default_security_width = '100px';
6
- $(function() {
7
- $('#wrapper_activities_header form').hide();
8
- $('#new_<%= SocialStream.activity_forms.first %>').show();
9
- $('#select_<%= SocialStream.activity_forms.first %>').addClass('selected');
10
- chosen = $('#security').security_chosen();
11
- $('#security').change(function() {
12
- $(this).children("option:selected").each(function(i,opt){
13
- if(opt.value==relation_public){
14
- if(public_selected==false){
15
- public_selected = true;
16
- for(id in relation_options){
17
- if(id==relation_public_pos){
18
- $("#securitychzn_o_" + relation_public_pos).click();
19
- }else{
20
- chosen.result_deselect(id);
21
- }
22
- }
23
- chosen.results_update_field();
24
- }else{
25
- if($('#security').children("option:selected").size()>1){
26
- public_selected = false;
27
- chosen.result_deselect(relation_public_pos);
28
- chosen.results_update_field();
29
- }
30
- }
31
- }
32
- });
33
-
34
- $('#securities .search-choice a').click(function(){
35
- if($('#security').children("option:selected").size()==0){
36
- $('#securities input').css('width', default_security_width)
37
- }
38
- });
39
- });
40
- $('#securities input').blur(function(){
41
- if($('#security').children("option:selected").size()==0){
42
- $('#securities input').css('width', default_security_width)
43
- }
44
- });
45
- // Remove width calculation
46
- $('#securities input.default').css('width', default_security_width);
47
- setActivityPrivacyTooltips();
48
- });
49
-
50
-
51
- $(document).ready(function() {
52
- activate_anti_rebounds();
53
- });
54
-
55
- activate_anti_rebounds = function(){
56
- $('#wrapper_activities_header form').submit(function() {
57
- $(this).find('input[type=text]').each(function() {
58
- $(this).blur().attr('readonly', true);
59
- });
60
- $("#masterSubmitButton").val(I18n.t('activity.sending') + '...').attr("disabled", true);
61
-
62
- // Add _relation_ids[] parameter from authorization selector
63
- $('.liveAdded').remove();
64
-
65
- var currentForm = $(this);
66
-
67
- $('#security option:selected').each(function() {
68
- currentForm.append(
69
- $('<input/>')
70
- .addClass('liveAdded')
71
- .attr('type', 'hidden')
72
- .attr('name', currentForm
73
- .attr('id').split('_')[1]+'[_relation_ids][]')
74
- .val($(this).attr('value')));
75
- });
76
- return true;
77
- });
78
-
79
- $('.new_comment').submit(function() {
80
- $(this).find('input[type=text]').each(function() {
81
- $(this).blur().attr('readonly', true);
82
- });
83
- $(this).find(".submitActivity").each(function() {
84
- $(this).val(I18n.t('activity.sending') + '...').attr("disabled", true);
85
- });
86
- return true;
87
- });
88
- }
89
-
90
-
91
- unblock_all_forms = function() {
92
- //Sharing buttons
93
- $(".submitActivity").val(I18n.t('share')).removeAttr("disabled");
94
- //Header activities form
95
- $("#masterSubmitButton").val(I18n.t('share')).removeAttr("disabled");
96
- $('#wrapper_activities_header form').find('input[type=text]').each(function() {
97
- $(this).removeAttr("readonly").val("").blur();
98
- });
99
- //New comments
100
- $('.input_new_comments').each(function() {chosen.result_deselect(0)
101
- $(this).removeAttr("readonly").val("");
102
- });
103
- }
104
7
 
105
8
  $('#masterSubmitButton').live('click',function(){
106
9
  $('#wrapper_activities_header form:visible').submit();
@@ -229,22 +132,3 @@ $('#left_scroll img').livequery("click",function(){
229
132
 
230
133
 
231
134
  });
232
-
233
- setActivityPrivacyTooltips = function(activityId) {
234
- var fullId = '.activity_audience';
235
- var summaryId = '.activity_audience_summary';
236
-
237
- if (activityId != undefined) {
238
- fullId = '#' + activityId + ' ' + fullId;
239
- summaryId = '#' + activityId + ' ' + summaryId;
240
- }
241
-
242
- $(fullId).hide();
243
- $(summaryId).tipsy({
244
- html: true,
245
- title: function(){
246
- return $(this).siblings('.activity_audience').html();
247
- }
248
- });
249
- };
250
-
@@ -10,4 +10,7 @@
10
10
  //= require avatars_for_rails
11
11
  //= require social_cheesecake
12
12
  //
13
+ //= require_self
13
14
  //= require_tree .
15
+
16
+ var SocialStream = SocialStream || {};
@@ -0,0 +1,42 @@
1
+ SocialStream.Timeline = (function(SS, $, undefined){
2
+ var setupCallbacks = [];
3
+
4
+ var addSetupCallback = function(callback){
5
+ setupCallbacks.push(callback);
6
+ }
7
+
8
+ var setup = function(){
9
+ $.each(setupCallbacks, function(i, callback){ callback(); });
10
+ }
11
+
12
+ var setPrivacyTooltips = function(activityId) {
13
+ var fullId = '.activity_audience';
14
+ var summaryId = '.activity_audience_summary';
15
+
16
+ if (activityId != undefined) {
17
+ fullId = '#' + activityId + ' ' + fullId;
18
+ summaryId = '#' + activityId + ' ' + summaryId;
19
+ }
20
+
21
+ $(fullId).hide();
22
+ $(summaryId).tipsy({
23
+ html: true,
24
+ title: function(){
25
+ return $(this).siblings('.activity_audience').html();
26
+ }
27
+ });
28
+ };
29
+
30
+ var newActivity = function(activityId){
31
+ setPrivacyTooltips(activityId);
32
+ SS.Wall.unblockForms();
33
+ }
34
+
35
+ addSetupCallback(setPrivacyTooltips);
36
+
37
+ return {
38
+ addSetupCallback: addSetupCallback,
39
+ setup: setup,
40
+ newActivity: newActivity
41
+ };
42
+ }) (SocialStream, jQuery);
@@ -0,0 +1,125 @@
1
+ //= require social_stream.timeline
2
+ //
3
+ SocialStream.Wall = (function(SS, $, undefined){
4
+ var setupCallbacks = [];
5
+
6
+ var addSetupCallback = function(callback){
7
+ setupCallbacks.push(callback);
8
+ }
9
+
10
+ var setup = function(){
11
+ $.each(setupCallbacks, function(i, callback){ callback(); });
12
+ }
13
+
14
+ var setupFirstForm = function(){
15
+ $('#wrapper_activities_header form').hide();
16
+ $('#new_<%= SocialStream.activity_forms.first %>').show();
17
+ $('#select_<%= SocialStream.activity_forms.first %>').addClass('selected');
18
+ }
19
+
20
+ var setupSecuritySelect = function(){
21
+ var default_security_width = '100px';
22
+
23
+ chosen = $('#security').security_chosen();
24
+
25
+ $('#security').change(function() {
26
+ $(this).children("option:selected").each(function(i,opt){
27
+ if(opt.value==relation_public){
28
+ if(public_selected==false){
29
+ public_selected = true;
30
+ for(id in relation_options){
31
+ if(id==relation_public_pos){
32
+ $("#securitychzn_o_" + relation_public_pos).click();
33
+ }else{
34
+ chosen.result_deselect(id);
35
+ }
36
+ }
37
+ chosen.results_update_field();
38
+ }else{
39
+ if($('#security').children("option:selected").size()>1){
40
+ public_selected = false;
41
+ chosen.result_deselect(relation_public_pos);
42
+ chosen.results_update_field();
43
+ }
44
+ }
45
+ }
46
+ });
47
+
48
+ $('#securities .search-choice a').click(function(){
49
+ if($('#security').children("option:selected").size()==0){
50
+ $('#securities input').css('width', default_security_width)
51
+ }
52
+ });
53
+ });
54
+
55
+ $('#securities input').blur(function(){
56
+ if($('#security').children("option:selected").size()==0){
57
+ $('#securities input').css('width', default_security_width)
58
+ }
59
+ });
60
+
61
+ // Remove width calculation
62
+ $('#securities input.default').css('width', default_security_width);
63
+
64
+ }
65
+
66
+ var activateAntiRebounds = function(){
67
+ $('#wrapper_activities_header form').submit(function() {
68
+ $(this).find('input[type=text]').each(function() {
69
+ $(this).blur().attr('readonly', true);
70
+ });
71
+ $("#masterSubmitButton").val(I18n.t('activity.sending') + '...').attr("disabled", true);
72
+
73
+ // Add _relation_ids[] parameter from authorization selector
74
+ $('.liveAdded').remove();
75
+
76
+ var currentForm = $(this);
77
+
78
+ $('#security option:selected').each(function() {
79
+ currentForm.append(
80
+ $('<input/>')
81
+ .addClass('liveAdded')
82
+ .attr('type', 'hidden')
83
+ .attr('name', currentForm
84
+ .attr('id').split('_')[1]+'[_relation_ids][]')
85
+ .val($(this).attr('value')));
86
+ });
87
+ return true;
88
+ });
89
+
90
+ $('.new_comment').submit(function() {
91
+ $(this).find('input[type=text]').each(function() {
92
+ $(this).blur().attr('readonly', true);
93
+ });
94
+ $(this).find(".submitActivity").each(function() {
95
+ $(this).val(I18n.t('activity.sending') + '...').attr("disabled", true);
96
+ });
97
+ return true;
98
+ });
99
+ }
100
+
101
+ var unblockForms = function() {
102
+ //Sharing buttons
103
+ $(".submitActivity").val(I18n.t('share')).removeAttr("disabled");
104
+ //Header activities form
105
+ $("#masterSubmitButton").val(I18n.t('share')).removeAttr("disabled");
106
+ $('#wrapper_activities_header form').find('input[type=text]').each(function() {
107
+ $(this).removeAttr("readonly").val("").blur();
108
+ });
109
+ //New comments
110
+ $('.input_new_comments').each(function() {chosen.result_deselect(0)
111
+ $(this).removeAttr("readonly").val("");
112
+ });
113
+ }
114
+
115
+ addSetupCallback(setupFirstForm);
116
+ addSetupCallback(setupSecuritySelect);
117
+ addSetupCallback(activateAntiRebounds);
118
+
119
+ return {
120
+ addSetupCallback: addSetupCallback,
121
+ setup: setup,
122
+ activateAntiRebounds: activateAntiRebounds,
123
+ unblockForms: unblockForms
124
+ };
125
+ }) (SocialStream, jQuery)
@@ -354,7 +354,15 @@
354
354
  .permissions_explanation_tipsy_menu.tipsy .tipsy-inner {
355
355
  max-width: 300px;
356
356
  text-align: left;
357
+ padding: 5px 8px 4px 2px;
357
358
  }
358
359
  .permissions_explanation_tipsy_menu.tipsy .tipsy-inner .permission {
359
- padding-top: 3px;
360
+ padding: 4px 0px 4px 20px;
361
+ text-align: justify;
362
+ }
363
+ .permissions_explanation_tipsy_menu.tipsy .tipsy-inner .permission.positive {
364
+ background: url("btn/permission_positive.png") 0px no-repeat;
365
+ }
366
+ .permissions_explanation_tipsy_menu.tipsy .tipsy-inner .permission.negative {
367
+ background: url("btn/permission_negative.png") 0px no-repeat;
360
368
  }
@@ -4,8 +4,6 @@ module NotificationsHelper
4
4
  def title_of(act_obj)
5
5
  if act_obj.is_a? Comment
6
6
  'Re: ' + title_of(act_obj.parent_post)
7
- elsif act_obj.is_a? Post and (not act_obj.text.nil?)
8
- act_obj.text.truncate(30, :separator => ' ')
9
7
  elsif act_obj.respond_to? :title and (not act_obj.title.nil?)
10
8
  act_obj.title.truncate(30, :separator => ' ')
11
9
  elsif act_obj.respond_to? :url and (not act_obj.url.nil?)
@@ -16,9 +14,7 @@ module NotificationsHelper
16
14
 
17
15
  # An activity object description
18
16
  def description_of(act_obj)
19
- if act_obj.respond_to? :text and (not act_obj.text.nil?)
20
- sanitize(act_obj.text)
21
- elsif act_obj.respond_to? :description and (not act_obj.description.nil?)
17
+ if act_obj.respond_to? :description and (not act_obj.description.nil?)
22
18
  sanitize(act_obj.description)
23
19
  else
24
20
  I18n.t('notification.watch_it')
@@ -209,15 +209,34 @@ class Activity < ActiveRecord::Base
209
209
  end
210
210
 
211
211
  def notify
212
- return true if !notificable?
212
+ return true unless notificable?
213
213
  #Avaible verbs: follow, like, make-friend, post, update
214
214
 
215
- if ['like','follow','make-friend','post','update'].include? verb and !channel.reflexive?
215
+ if direct_object.is_a? Comment
216
+ participants.each do |p|
217
+ p.notify(notification_subject, "Youre not supposed to see this", self) unless p == sender
218
+ end
219
+ elsif ['like','follow','make-friend','post','update'].include? verb and !channel.reflexive?
216
220
  receiver.notify(notification_subject, "Youre not supposed to see this", self)
217
221
  end
218
222
  true
219
223
  end
220
224
 
225
+ # A list of participants
226
+ def participants
227
+ parts=Set.new
228
+ same_thread.map{|a| a.activity_objects.first}.each do |ao|
229
+ parts << ao.author if ao.respond_to? :author and !ao.author.nil?
230
+ end
231
+ parts
232
+ end
233
+
234
+ # This and related activities
235
+ def same_thread
236
+ return [self] if ancestry.nil?
237
+ [Activity.find(ancestry)] + Activity.find_all_by_ancestry(ancestry)
238
+ end
239
+
221
240
  # Is subject allowed to perform action on this {Activity}?
222
241
  def allow?(subject, action)
223
242
  return false if channel.blank?
@@ -1,6 +1,7 @@
1
1
  class Comment < ActiveRecord::Base
2
2
  include SocialStream::Models::Object
3
3
 
4
+ alias_attribute :text, :description
4
5
  validates_presence_of :text
5
6
 
6
7
  def parent_post
@@ -11,4 +12,8 @@ class Comment < ActiveRecord::Base
11
12
  self._relation_ids = Activity.find(id).relation_ids
12
13
  @_activity_parent_id = id
13
14
  end
15
+
16
+ def title
17
+ description.truncate(30, :separator =>' ')
18
+ end
14
19
  end
@@ -46,7 +46,22 @@ class Permission < ActiveRecord::Base
46
46
  # An explanation of the permissions. Type can be brief or detailed.
47
47
  # If detailed, description includes more information about the relation
48
48
  def description(type, options = {})
49
- I18n.t "permission.description.#{ type }.#{ action }.#{ object || "nil" }",
49
+ unless options[:subject].present?
50
+ raise "Now we need subject for permission description"
51
+ end
52
+
53
+ options[:name] = options[:subject].name
54
+
55
+ prefix = "permission.description"
56
+ suffix = "#{ type }.#{ action }.#{ object || "nil" }"
57
+
58
+ if options[:state]
59
+ suffix += ".#{ options[:state] }"
60
+ end
61
+
62
+ options[:default] = :"#{ prefix }.default.#{ suffix }"
63
+
64
+ I18n.t "#{ prefix }.#{ options[:subject].subject_type.underscore }.#{ suffix }",
50
65
  options
51
66
  end
52
67
  end
@@ -1,6 +1,7 @@
1
1
  class Post < ActiveRecord::Base
2
2
  include SocialStream::Models::Object
3
3
 
4
+ alias_attribute :text, :description
4
5
  validates_presence_of :text
5
6
 
6
7
  define_index do
@@ -9,4 +10,8 @@ class Post < ActiveRecord::Base
9
10
  has created_at
10
11
  end
11
12
 
13
+ def title
14
+ description.truncate(30, :separator =>' ')
15
+ end
16
+
12
17
  end