social_stream 0.13.1 → 0.13.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,8 @@
1
- class CommentsController < InheritedResources::Base
2
- load_and_authorize_resource
1
+ class CommentsController < ApplicationController
2
+ include SocialStream::Controllers::Objects
3
3
 
4
- respond_to :html, :xml, :js
5
-
6
- def destroy
7
- @post_activity = resource.post_activity
8
-
9
- destroy!
10
- end
11
-
12
4
  def show
13
5
  parent = resource.post_activity.parent
14
6
  redirect_to polymorphic_path(parent.direct_object,:anchor => dom_id(parent))
15
7
  end
16
-
17
-
18
8
  end
@@ -15,7 +15,7 @@
15
15
  :html => { :class => "new_comment", :id => "new_comment"+dom_id(activity) },
16
16
  :remote => true do |f| %>
17
17
 
18
- <%= f.hidden_field :_contact_id %>
18
+ <%= f.hidden_field :owner_id %>
19
19
  <%= f.hidden_field :_activity_parent_id %>
20
20
 
21
21
  <div class="input_new_comments_container">
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.10.1".freeze
3
+ VERSION = "0.10.2".freeze
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.13.1".freeze
2
+ VERSION = "0.13.2".freeze
3
3
  end
@@ -18,19 +18,20 @@ statusIcons['dnd'] = "dnd";
18
18
 
19
19
  var connectButtonTimer;
20
20
  var periodBetweenAttempts=15; //(seg)
21
- var connectButtonTimerCounter=periodBetweenAttempts;
21
+ var connectButtonTimerCounter=periodBetweenAttempts+1;
22
22
 
23
23
  function connectButtonTimerFunction(){
24
- if(connectButtonTimerCounter < periodBetweenAttempts){
25
- connectButtonTimerCounter++;
26
- } else if (connectButtonTimerCounter == periodBetweenAttempts) {
24
+ connectButtonTimerCounter++;
25
+ if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
26
+ clearTimeout(connectButtonTimer);
27
27
  $("#chat_header_title").html('<%=I18n.t('chat.disconnected')%>')
28
28
  }
29
29
  }
30
30
 
31
31
  function requestConnectToChat(){
32
32
  if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
33
- connectButtonTimerCounter=0;
33
+ connectButtonTimerCounter=0;
34
+ connectButtonTimer = setInterval("connectButtonTimerFunction()", 1000)
34
35
  $("#chat_header_title").html('<%=I18n.t('chat.connecting')%>')
35
36
  return true
36
37
  } else {
@@ -292,4 +293,41 @@ function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){
292
293
  playSound("onMessageAudio");
293
294
  }
294
295
 
296
+ }
297
+
298
+
299
+ ////////////////////
300
+ //Notifications on chat Window
301
+ ////////////////////
302
+
303
+ function showChatNotificationForSlug(slug,msg){
304
+ var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
305
+ showChatNotification(notification,msg);
306
+ }
307
+
308
+ function showChatNotification(notification,msg){
309
+ notification.html("<p class==\"ui-chatbox-notify-text\">" + msg + "</p>");
310
+ notification.css("visibility","visible");
311
+ notification.fadeIn();
312
+ }
313
+
314
+ function hideChatNotificationForSlug(slug){
315
+ var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
316
+ hideChatNotification(notification);
317
+ }
318
+
319
+ function hideChatNotification(notification){
320
+ notification.fadeOut();
321
+ notification.css("visibility","hidden");
322
+ }
323
+
324
+ function notifyWhenUsersDisconnect(){
325
+ var notification = $("div.ui-chatbox-notify");
326
+ var msg = '<%=I18n.t('chat.notify.offline')%>';
327
+ showChatNotification(notification,msg);
328
+ }
329
+
330
+ function hideAllNotifications(){
331
+ var notification = $("div.ui-chatbox-notify");
332
+ hideChatNotification(notification);
295
333
  }
@@ -65,6 +65,19 @@ function blinkTitleOnMessage(username){
65
65
 
66
66
 
67
67
 
68
+ ////////////////////
69
+ //Control user data input on the chatbox
70
+ ////////////////////
71
+
72
+ //Return true to allow user to send data to the chatbox.
73
+ function userChatDataInputControl(){
74
+ var floodControlBoolean = floodControl();
75
+ var offlineDataSendControlBoolean = offlineDataSendControl();
76
+ return (floodControlBoolean && offlineDataSendControlBoolean);
77
+ }
78
+
79
+
80
+
68
81
  ////////////////////
69
82
  //Antiflood
70
83
  ////////////////////
@@ -190,6 +203,19 @@ function mustBounceBoxForChatWindow(jqueryUIChatbox){
190
203
 
191
204
  }
192
205
 
206
+
207
+
208
+ ////////////////////
209
+ //Prevent user to send data to the chatbox when he is offline.
210
+ ////////////////////
211
+
212
+ function offlineDataSendControl(){
213
+ return ((!disconnectionFlag) && (isStropheConnected()));
214
+ }
215
+
216
+
217
+
218
+
193
219
  ////////////////////
194
220
  //Next features...
195
221
  ////////////////////
@@ -160,6 +160,7 @@ function onConnect(status) {
160
160
  log('Strophe is disconnected.');
161
161
  disconnectionFlag = true;
162
162
  clearTimeout(awayTimer);
163
+ notifyWhenUsersDisconnect();
163
164
  reconnectTimer = setTimeout ("onReconnect()", 5000);
164
165
  } else if (status == Strophe.Status.CONNECTED) {
165
166
  log('Strophe is connected.');
@@ -173,13 +174,14 @@ function onConnect(status) {
173
174
  sendStatus(userStatus);
174
175
  awayTimer = setInterval("awayTimerFunction()", awayTimerPeriod);
175
176
  timer = setInterval("timerFunction()", timerPeriod);
177
+ hideAllNotifications();
176
178
  }
177
179
 
178
180
  updateChatWindow();
179
181
  }
180
182
 
181
183
  function onReconnect(){
182
- log("onReconnect!")
184
+
183
185
  if ((!isStropheConnected())&&(userStatus!="offline")) {
184
186
 
185
187
  if (reconnectAttempts>0) {
@@ -273,6 +275,7 @@ function processAvailablePresenceStanza(presence){
273
275
  setUserIconStatus(slug, status);
274
276
  if (cacheConnectedUsers.indexOf(slug) != -1) {
275
277
  showConnectionBoxFromSlug(slug);
278
+ hideChatNotificationForSlug(slug);
276
279
  }
277
280
  } else {
278
281
  setTimeout("refreshChatWindow()", 3000);
@@ -287,6 +290,7 @@ function processUnavailablePresenceStanza(presence){
287
290
  if (slug != user_slug) {
288
291
  if (getConnectionBoxFromSlug(slug)!=null){
289
292
  hideConnectionBoxFromSlug(slug)
293
+ showChatNotificationForSlug(slug,$(getConnectionBoxFromSlug(slug)).attr("name") + " is offline");
290
294
  }
291
295
  }
292
296
  }
@@ -62,6 +62,30 @@
62
62
  clear: both;
63
63
  }
64
64
 
65
+ div.ui-chatbox-notify{
66
+ visibility: hidden;
67
+ background: #E5E5E5;
68
+ background-color: #E5E5E5;
69
+ color: black;
70
+ z-index: 1;
71
+ position:absolute;
72
+ top: 0;
73
+ margin-top: 30px;
74
+ padding: 4px 0px 4px 0px;
75
+ width: 236px;
76
+ text-align: center;
77
+ border-style:solid;
78
+ border-width:1px;
79
+ border-color: #CCCCCC;
80
+ opacity:0.95;
81
+ filter:alpha(opacity=95); /* For IE8 and earlier */
82
+ }
83
+
84
+ p.ui-chatbox-notify-text{
85
+ text-align: center;
86
+ font-weight: bold;
87
+ }
88
+
65
89
 
66
90
  /* Ticks */
67
91
 
@@ -1,9 +1,6 @@
1
1
  <script type="text/javascript">
2
2
  $(document).ready(function () {
3
3
 
4
- connectButtonTimer = setInterval("connectButtonTimerFunction()", 1000)
5
- connectButtonTimerCounter=periodBetweenAttempts+1
6
-
7
4
  if (authByCookie()){
8
5
  //Authentication by cookie
9
6
 
@@ -3,7 +3,7 @@ en:
3
3
  connecting: "Chat Connecting"
4
4
  reconnecting: "Chat Reconnecting"
5
5
  disconnected: "Chat Disconnected"
6
- unableconnect: "Chat Disconnected"
6
+ unableconnect: "Chat Out of Service"
7
7
  title: "Chat"
8
8
  password: "Password"
9
9
  status:
@@ -15,4 +15,6 @@ en:
15
15
  settings:
16
16
  title: "Enable and configure Social Stream Chat"
17
17
  checkbox: "Enable or disable Social Stream Chat"
18
- update: "Update Settings"
18
+ update: "Update Settings"
19
+ notify:
20
+ offline: "You are offline"
@@ -3,7 +3,7 @@ es:
3
3
  connecting: "Chat Conectando"
4
4
  reconnecting: "Chat Reconectando"
5
5
  disconnected: "Chat Desconectado"
6
- unableconnect: "Chat Desconectado"
6
+ unableconnect: "Chat Fuera de servicio"
7
7
  title: "Chat"
8
8
  password: "Contraseña"
9
9
  status:
@@ -16,4 +16,6 @@ es:
16
16
  title: "Activación y configuración del chat de Social Stream"
17
17
  checkbox: "Activar o desactivar chat"
18
18
  update: "Guardar configuración"
19
+ notify:
20
+ offline: "Desconectado"
19
21
 
@@ -1,5 +1,5 @@
1
1
  module Socialstream
2
2
  module Presence
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -167,7 +167,9 @@
167
167
  .addClass('ui-icon-minusthick ' + 'chat-thick ' + ' chat-minusthick')
168
168
  .text('minimize')
169
169
  .appendTo(uiChatboxTitlebarMinimize),
170
- // content
170
+
171
+
172
+ // content
171
173
  uiChatboxContent = (self.uiChatboxContent = $('<div></div>'))
172
174
  .addClass('ui-widget-content ' +
173
175
  'ui-chatbox-content '
@@ -179,6 +181,19 @@
179
181
  'ui-chatbox-log'
180
182
  )
181
183
  .appendTo(uiChatboxContent),
184
+
185
+ //Notification div
186
+ uiChatboxNotify = (self.uiChatboxNotify = $('<div></div>'))
187
+ .addClass('ui-widget-content ' +
188
+ 'ui-chatbox-notify'
189
+ )
190
+ .click(function(event) {
191
+ // anything?
192
+ self.uiChatboxNotify.fadeOut();
193
+ })
194
+ .appendTo(uiChatboxContent),
195
+
196
+
182
197
  uiChatboxInput = (self.uiChatboxInput = $('<div></div>'))
183
198
  .addClass('ui-widget-content ' +
184
199
  'ui-chatbox-input'
@@ -195,7 +210,8 @@
195
210
  .appendTo(uiChatboxInput)
196
211
  .keydown(function(event) {
197
212
  if(event.keyCode && event.keyCode == $.ui.keyCode.ENTER) {
198
- if (((typeof floodControl == 'function')&&(floodControl()))||((typeof floodControl != 'function'))) {
213
+ var userChatDataInputControlBoolean = (((typeof userChatDataInputControl == 'function')&&(userChatDataInputControl()))||((typeof userChatDataInputControl != 'function')));
214
+ if (userChatDataInputControlBoolean) {
199
215
  msg = $.trim($(this).val());
200
216
  if (msg.length > 0) {
201
217
  self.options.messageSent(self.options.id, self.options.user, msg);
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files`.split("\n")
12
12
 
13
13
  # Gem dependencies
14
- s.add_runtime_dependency('social_stream-base', '~> 0.10.1')
14
+ s.add_runtime_dependency('social_stream-base', '~> 0.10.2')
15
15
  s.add_runtime_dependency('social_stream-documents', '~> 0.5.0')
16
16
  s.add_runtime_dependency('social_stream-events', '~> 0.1.0')
17
17
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 47
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 13
9
- - 1
10
- version: 0.13.1
9
+ - 2
10
+ version: 0.13.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - GING - DIT - UPM
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-28 00:00:00 +01:00
19
+ date: 2011-12-01 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,12 +27,12 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 53
30
+ hash: 51
31
31
  segments:
32
32
  - 0
33
33
  - 10
34
- - 1
35
- version: 0.10.1
34
+ - 2
35
+ version: 0.10.2
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency