social_stream 0.20.2 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.15.2')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.16.0')
16
16
  s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
17
17
  s.add_runtime_dependency('paperclip','= 2.4.5')
18
18
  s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
@@ -1,4 +1,5 @@
1
1
  Factory.define :document do |d|
2
+ d.sequence(:title) { |n| "Document #{ n }" }
2
3
  d.file { Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), 'files', 'small.pdf'),
3
4
  'application/pdf') }
4
5
 
@@ -1,4 +1,5 @@
1
1
  Factory.define :picture do |p|
2
+ p.sequence(:title) { |n| "Picture #{ n }" }
2
3
  p.file { Rack::Test::UploadedFile.new(File.join(File.dirname(__FILE__), 'files', 'rails.png'),
3
4
  'image/png') }
4
5
 
@@ -0,0 +1,26 @@
1
+ class EventsGroupTitleAndDescriptionInActivityObject < ActiveRecord::Migration
2
+ def up
3
+ ao_ts = ActivityObject.record_timestamps
4
+ ActivityObject.record_timestamps = false
5
+
6
+ # Fix 'events' table
7
+ e_ts = Event.record_timestamps
8
+ Event.record_timestamps = false
9
+
10
+ Event.all.each do |e|
11
+ e.activity_object.title = e.read_attribute(:title)
12
+ e.save!
13
+ end
14
+ change_table :events do |t|
15
+ t.remove :title
16
+ end
17
+ Event.reset_column_information
18
+ Event.record_timestamps = e_ts
19
+
20
+ ActivityObject.record_timestamps = ao_ts
21
+ end
22
+
23
+ def down
24
+ raise ActiveRecord::IrreversibleMigration # Due to trans-gem oddities
25
+ end
26
+ end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Events
3
- VERSION = "0.7.1".freeze
3
+ VERSION = "0.8.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.15.2')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.16.0')
16
16
  s.add_runtime_dependency('rails-scheduler', '~> 0.0.6')
17
17
  s.add_runtime_dependency('coffee-rails', '>= 3.1.0')
18
18
 
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.20.2".freeze
2
+ VERSION = "0.21.0".freeze
3
3
  end
@@ -1,9 +1,7 @@
1
1
  //Display the new post
2
2
  $("#wall").prepend("<%= escape_javascript(render @link.post_activity) %>");
3
3
 
4
- setActivityPrivacyTooltips("<%= escape_javascript dom_id(@link.post_activity) %>");
5
-
6
- unblock_all_forms();
4
+ SocialStream.Timeline.newActivity("<%= escape_javascript dom_id(@link.post_activity) %>");
7
5
 
8
6
  $("#link_preview").hide();
9
7
  $("#link_preview").html("");
@@ -0,0 +1,30 @@
1
+ class LinkserGroupTitleAndDescriptionInActivityObject < ActiveRecord::Migration
2
+ def up
3
+ ao_ts = ActivityObject.record_timestamps
4
+ ActivityObject.record_timestamps = false
5
+
6
+ # Fix 'links' table
7
+ l_ts = Link.record_timestamps
8
+ Link.record_timestamps = false
9
+
10
+ Link.all.each do |l|
11
+ l.activity_object.title = l.read_attribute(:title)
12
+ l.activity_object.description = l.read_attribute(:description)
13
+ l.save!
14
+ end
15
+
16
+ change_table :links do |t|
17
+ t.remove :title
18
+ t.remove :description
19
+ end
20
+
21
+ Link.reset_column_information
22
+ Link.record_timestamps = l_ts
23
+
24
+ ActivityObject.record_timestamps = ao_ts
25
+ end
26
+
27
+ def down
28
+ raise ActiveRecord::IrreversibleMigration # Due to trans-gem oddities
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "0.5.0".freeze
3
+ VERSION = "0.6.0".freeze
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n")
13
13
 
14
14
  # Gem dependencies
15
- s.add_runtime_dependency('social_stream-base', '~> 0.15.0')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.16.0')
16
16
  s.add_runtime_dependency('linkser', '~> 0.0.10')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
@@ -1,3 +1,5 @@
1
+ var global;
2
+
1
3
  ////////////////////
2
4
  //Reconnect button interface functions
3
5
  ////////////////////
@@ -30,8 +32,15 @@ function requestConnectToChat(){
30
32
  //Chat interface: Connection boxes
31
33
  ////////////////////
32
34
 
35
+ var focusSearchContactsFlag=false;
36
+
33
37
  function setUserFunctions(){
34
-
38
+
39
+ settingTooltips();
40
+
41
+ ///////////////////////
42
+ //Open chatbox function
43
+ ///////////////////////
35
44
  $("div.user_presence").click(function(event, ui){
36
45
  var guest_name = $(this).attr("name");
37
46
  var guest_slug = $(this).attr("slug");
@@ -43,10 +52,21 @@ function setUserFunctions(){
43
52
  };
44
53
  });
45
54
 
55
+
56
+ //Hide tooltips on mouseleave
57
+ $("div.user_presence").mouseleave(function(e){
58
+ var div = $(this);
59
+ $.each($(".tooltip:visible"), function(index, value) {
60
+ if ( $($(".tooltip:visible")[0]).html() == $(div).attr("name") ){
61
+ $($(".tooltip:visible")[index]).hide();
62
+ }
63
+ });
64
+ });
46
65
 
47
- ////////////////////
48
- //Chat interface: Status selector
49
- ////////////////////
66
+
67
+ ////////////////////
68
+ //Chat interface: Status selector
69
+ ////////////////////
50
70
 
51
71
  //JQuery DropdwanStatus
52
72
 
@@ -78,15 +98,105 @@ function setUserFunctions(){
78
98
 
79
99
  $(document).bind('click', function(e) {
80
100
  var $clicked = $(e.target);
101
+
81
102
  if (! $clicked.parents().hasClass("dropdown")){
82
103
  //Click outside the select...
83
104
  $(".dropdown dd ul").hide();
84
105
  setStatusWidgetTitle(userStatus);
85
106
  }
86
107
  });
108
+
109
+ ///////////////
110
+ //Search contacts enabling
111
+ ///////////////
112
+ $("select.flexselect").flexselect({
113
+ allowMismatch: true
114
+ });
115
+
116
+ //Select contact function
117
+ //callback in changeSelectContactValue()
118
+
119
+
120
+ $("#search_chat_contact_flexselect").focus(function(e) {
121
+ changeContactListVisibility(true);
122
+ });
123
+
124
+ $("#search_chat_contact_flexselect").blur(function(e) {
125
+ changeContactListVisibility(false);
126
+ });
127
+
128
+ }
129
+
130
+
131
+ function changeSelectContactValue(name,value){
132
+ $("#search_chat_contact_flexselect").blur();
133
+
134
+ if(value == "ZERO_CONTACTS"){
135
+ return;
136
+ }
137
+
138
+ var guest_slug = value;
139
+ var guest_name = name;
140
+ var guest_jid = guest_slug + "@" + domain;
141
+ if (createChatBox(guest_slug, guest_name, guest_jid, user_name, user_jid)) {
142
+ } else {
143
+ window[getChatVariableFromSlug(guest_slug)].chatbox("option", "boxManager").toggleBox(true);
144
+ };
145
+
146
+ //Check for online status and show notification
147
+ if (getAllConnectedSlugs().indexOf(guest_slug)==-1) {
148
+ showOfflineChatNotificationForSlug(guest_slug);
149
+ }
87
150
 
151
+ changeContactListVisibility(false);
88
152
  }
89
153
 
154
+
155
+ function settingTooltips(){
156
+ if (mainChatBox == null) {
157
+ //Enabling default tooltips
158
+ $(".user_presence a[title]").tooltip();
159
+ } else {
160
+ //Enabling tooltips with center left position
161
+
162
+ //Changing Tooltip CSS class by JQuery
163
+ var ss = document.styleSheets;
164
+ for (var i=0; i<ss.length; i++) {
165
+ var rules = ss[i].cssRules || ss[i].rules;
166
+ for (var j=0; j<rules.length; j++) {
167
+ if (rules[j].selectorText === ".tooltip") {
168
+ rules[j].style.background = 'url("black_arrow9.png") repeat scroll 0% 0% transparent'
169
+ }
170
+ }
171
+ }
172
+ $(".user_presence a[title]").tooltip({
173
+ opacity: 0.95,
174
+ relative: false,
175
+ position: 'top left',
176
+ offset: [0,37]
177
+ });
178
+ }
179
+ }
180
+
181
+
182
+ function changeContactListVisibility(visible){
183
+ var nItems = $("#search_chat_contact_flexselect_dropdown ul li").length-1;
184
+ if (visible){
185
+ focusSearchContactsFlag=true;
186
+ if(nItems > 9){
187
+ changeMainChatBoxHeight(mainChatBoxHeightWhileSearchContacts);
188
+ } else {
189
+ var mainChatBoxMinRequiredHeight= mainChatBoxaddonsHeight + 20 + nItems * 19;
190
+ changeMainChatBoxHeight(mainChatBoxMinRequiredHeight);
191
+ }
192
+ $(".users_connected").hide();
193
+ } else {
194
+ changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
195
+ $(".users_connected").show();
196
+ }
197
+ }
198
+
199
+
90
200
  function setStatusWidgetTitle(status){
91
201
 
92
202
  if((status in sstreamChatStatus)){
@@ -179,14 +289,18 @@ function updateChatWindow(){
179
289
  $.post("/chatWindow", { userConnected: stropheConnectedAndOnlineStatus }, function(data){
180
290
  $(".tooltip").hide() //Prevent tooltips
181
291
  $("#chat_partial").html(modifyChatPartialIfMainBox(data));
292
+ updateConnectedUsersOfMainChatBox();
182
293
  if (isStropheConnected()) {
183
294
  setStatusWidgetTitle(userStatus);
184
- $(".user_presence a[title]").tooltip();
185
- setUserFunctions();
186
- updateConnectedUsersOfMainChatBox();
295
+ setUserFunctions();
187
296
  if (afterNewConnectionFlag){
188
297
  afterNewConnectionFlag = false;
189
- restoreChatData();
298
+ if(afterFirstConnectionFlag){
299
+ restoreChatData();
300
+ afterFirstConnectionFlag = false;
301
+ } else {
302
+ updateAllNotifications();
303
+ }
190
304
  }
191
305
  }
192
306
  });
@@ -201,11 +315,23 @@ function getConnectionBoxFromSlug(slug){
201
315
  }
202
316
 
203
317
  var cacheConnectedUsers = [];
318
+
204
319
  function hideConnectionBoxFromSlug(slug){
205
320
  if ($('div.user_presence[slug=' + slug + ']').length > 0){
206
321
  $('div.user_presence[slug=' + slug + ']').hide();
207
322
  if(cacheConnectedUsers.indexOf(slug)==-1){
208
323
  cacheConnectedUsers.push(slug);
324
+ }
325
+ updateMainChatBoxAfterUserDisconnect();
326
+
327
+ //Last user disconnected?
328
+ if (getAllConnectedSlugs().length ==0){
329
+ if($(".users_connected p.zero_users_connected").length > 0){
330
+ $(".users_connected p.zero_users_connected").show();
331
+ } else {
332
+ var msg = '<%=I18n.t('chat.zerousers')%>';
333
+ $(".users_connected").append('<p class="zero_users_connected">' + msg + '</p>')
334
+ }
209
335
  }
210
336
  }
211
337
  }
@@ -214,6 +340,7 @@ function showConnectionBoxFromSlug(slug){
214
340
  if ($('div.user_presence[slug=' + slug + ']').length > 0){
215
341
  if (!($('div.user_presence[slug=' + slug + ']').is(":visible"))){
216
342
  $('div.user_presence[slug=' + slug + ']').show();
343
+ $(".users_connected p.zero_users_connected").hide();
217
344
  }
218
345
  }
219
346
  }
@@ -229,17 +356,29 @@ function setUserIconStatus(slug, status){
229
356
  }
230
357
 
231
358
  function getAllConnectedSlugs(){
232
- connectedSlugs=[];
359
+ return getAllSlugsByChatConnectedState()[0];
360
+ }
361
+
362
+ function getAllDisconnectedSlugs(){
363
+ return getAllSlugsByChatConnectedState()[1];
364
+ }
365
+
366
+ function getAllSlugsByChatConnectedState(){
367
+ var onlineSlugs=[];
368
+ var offlineSlugs=[];
369
+ var allSlugs=[];
233
370
  connectionBoxes = $('div.user_presence[slug]');
234
371
  $.each(connectionBoxes, function(index, value) {
235
- if($(value).css("display")!="none"){
236
- connectedSlugs.push($(value).attr("slug"))
237
- }
372
+ if($(value).css("display")!="none"){
373
+ onlineSlugs.push($(value).attr("slug"))
374
+ } else {
375
+ offlineSlugs.push($(value).attr("slug"))
376
+ }
377
+ allSlugs.push($(value).attr("slug"))
238
378
  });
239
- return connectedSlugs
379
+ return [onlineSlugs,offlineSlugs,allSlugs]
240
380
  }
241
381
 
242
-
243
382
  ////////////////////
244
383
  //Insert received message in chatbox
245
384
  ////////////////////
@@ -293,20 +432,24 @@ function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){
293
432
  //Notifications on chat Window
294
433
  ////////////////////
295
434
 
296
- function showChatNotificationForSlug(slug,msg){
297
- var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
298
- showChatNotification(notification,msg);
299
- }
300
-
301
435
  function showChatNotification(notification,msg){
302
436
  notification.html("<p class==\"ui-chatbox-notify-text\">" + msg + "</p>");
303
437
  notification.css("visibility","visible");
304
438
  notification.fadeIn();
305
439
  }
306
440
 
307
- function hideChatNotificationForSlug(slug){
441
+ function showChatNotificationForSlug(slug,msg){
308
442
  var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
309
- hideChatNotification(notification);
443
+ showChatNotification(notification,msg);
444
+ }
445
+
446
+ function showOfflineChatNotificationForSlug(slug){
447
+ var slug_chat_box = getChatBoxForSlug(slug);
448
+ if(slug_chat_box!=null){
449
+ var name = slug_chat_box.attr("name")
450
+ var msg = name + ' ' + '<%=I18n.t('chat.notify.guestOffline')%>';
451
+ showChatNotificationForSlug(slug,msg);
452
+ }
310
453
  }
311
454
 
312
455
  function hideChatNotification(notification){
@@ -314,6 +457,11 @@ function hideChatNotification(notification){
314
457
  notification.css("visibility","hidden");
315
458
  }
316
459
 
460
+ function hideChatNotificationForSlug(slug){
461
+ var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
462
+ hideChatNotification(notification);
463
+ }
464
+
317
465
  function notifyWhenUsersDisconnect(){
318
466
  var notification = $("div.ui-chatbox-notify");
319
467
  var msg = '<%=I18n.t('chat.notify.offline')%>';
@@ -325,6 +473,17 @@ function hideAllNotifications(){
325
473
  hideChatNotification(notification);
326
474
  }
327
475
 
476
+ function updateAllNotifications(){
477
+ hideAllNotifications();
478
+ if(disconnectionFlag){
479
+ notifyWhenUsersDisconnect();
480
+ } else {
481
+ //Notification for offline contacts
482
+ $.each(getAllDisconnectedSlugsWithChatBoxes(), function(index, value) {
483
+ showOfflineChatNotificationForSlug(value)
484
+ });
485
+ }
486
+ }
328
487
 
329
488
 
330
489
  ////////////////////
@@ -332,6 +491,15 @@ function hideAllNotifications(){
332
491
  ////////////////////
333
492
 
334
493
  function updateConnectedUsersOfMainChatBox(){
335
- var connectedUsers = getAllConnectedSlugs().length;
336
- changeMainChatBoxHeaderTitle( '<%=I18n.t('chat.title')%>' + " (" + connectedUsers + ")");
494
+ if(mainChatBox!=null){
495
+ var connectedUsers = getAllConnectedSlugs().length;
496
+ changeMainChatBoxHeaderTitle( '<%=I18n.t('chat.title')%>' + " (" + connectedUsers + ")");
497
+ changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
498
+ }
337
499
  }
500
+
501
+
502
+ function updateMainChatBoxAfterUserDisconnect(){
503
+ changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
504
+ updateConnectedUsersOfMainChatBox();
505
+ }