Commit d4ce25952f67ee05f17b3975ea1352e1ab5d1fe0
1 parent
88a8110f
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fixes
Showing
4 changed files
with
29 additions
and
28 deletions
Show diff stats
plugins/community_hub/lib/community_hub_plugin/hub.rb
@@ -5,12 +5,19 @@ class CommunityHubPlugin::Hub < Folder | @@ -5,12 +5,19 @@ class CommunityHubPlugin::Hub < Folder | ||
5 | 5 | ||
6 | attr_accessible :last_changed_by_id, :integer | 6 | attr_accessible :last_changed_by_id, :integer |
7 | 7 | ||
8 | + attr_accessible :twitter_enabled, :type => :booelan, :default => false | ||
9 | + attr_accessible :twitter_hashtags, :type => :string, :default => "" | ||
10 | + attr_accessible :twitter_consumer_key, :type => :string, :default => "" | ||
11 | + attr_accessible :twitter_consumer_secret, :type => :string, :default => "" | ||
12 | + attr_accessible :twitter_access_token, :type => :string, :default => "" | ||
13 | + attr_accessible :twitter_access_token_secret, :type => :string, :default => "" | ||
14 | + | ||
8 | settings_items :twitter_enabled, :type => :boolean, :default => false | 15 | settings_items :twitter_enabled, :type => :boolean, :default => false |
9 | settings_items :twitter_hashtags, :type => :string, :default => "" | 16 | settings_items :twitter_hashtags, :type => :string, :default => "" |
10 | - settings_items :twitter_consumer_key, :type => :string, :default => "" | ||
11 | - settings_items :twitter_consumer_secret, :type => :string, :default => "" | ||
12 | - settings_items :twitter_access_token, :type => :string, :default => "" | ||
13 | - settings_items :twitter_access_token_secret, :type => :string, :default => "" | 17 | + settings_items :twitter_consumer_key, :type => :string, :default => "" |
18 | + settings_items :twitter_consumer_secret, :type => :string, :default => "" | ||
19 | + settings_items :twitter_access_token, :type => :string, :default => "" | ||
20 | + settings_items :twitter_access_token_secret, :type => :string, :default => "" | ||
14 | settings_items :facebook_enabled, :type => :boolean, :default => false | 21 | settings_items :facebook_enabled, :type => :boolean, :default => false |
15 | settings_items :facebook_page_id, :type => :string, :default => "" | 22 | settings_items :facebook_page_id, :type => :string, :default => "" |
16 | settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds | 23 | settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds |
plugins/community_hub/public/javascripts/community_hub.js
@@ -103,12 +103,12 @@ function new_message(button) { | @@ -103,12 +103,12 @@ function new_message(button) { | ||
103 | if (data.ok) { | 103 | if (data.ok) { |
104 | jQuery(".hub .form-message #message_body").val(''); | 104 | jQuery(".hub .form-message #message_body").val(''); |
105 | jQuery(".hub .form-message .submit").attr("disabled", false); | 105 | jQuery(".hub .form-message .submit").attr("disabled", false); |
106 | - update_live_stream(false); | ||
107 | - message_interval_id = setInterval(function() { update_live_stream(false)}, 5000); | 106 | + update_live_stream(); |
107 | + message_interval_id = setInterval(function() { update_live_stream()}, 5000); | ||
108 | } | 108 | } |
109 | else { | 109 | else { |
110 | jQuery(".hub .form-message .submit").attr("disabled", false); | 110 | jQuery(".hub .form-message .submit").attr("disabled", false); |
111 | - message_interval_id = setInterval(function() { update_live_stream(false)}, 5000); | 111 | + message_interval_id = setInterval(function() { update_live_stream()}, 5000); |
112 | } | 112 | } |
113 | }, 'json'); | 113 | }, 'json'); |
114 | 114 | ||
@@ -263,8 +263,7 @@ function update_mediations() { | @@ -263,8 +263,7 @@ function update_mediations() { | ||
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | -function update_live_stream(recursive) { | ||
267 | - | 266 | +function update_live_stream() { |
268 | if (jQuery("#left-tab.show").size() != 0) { | 267 | if (jQuery("#left-tab.show").size() != 0) { |
269 | 268 | ||
270 | var hub_id = jQuery(".hub").attr('id'); | 269 | var hub_id = jQuery(".hub").attr('id'); |
@@ -281,32 +280,26 @@ function update_live_stream(recursive) { | @@ -281,32 +280,26 @@ function update_live_stream(recursive) { | ||
281 | type: 'get', | 280 | type: 'get', |
282 | data: { latest_post: latest_post_id, hub: hub_id }, | 281 | data: { latest_post: latest_post_id, hub: hub_id }, |
283 | success: function(data) { | 282 | success: function(data) { |
283 | + | ||
284 | if (data.trim().length > 0) { | 284 | if (data.trim().length > 0) { |
285 | jQuery("#live-posts").prepend(data); | 285 | jQuery("#live-posts").prepend(data); |
286 | - if (jQuery("#auto_scrolling").attr('checked')) { | 286 | + if (jQuery("#auto_scrolling").prop('checked', true)) { |
287 | jQuery("#live-posts").scrollTop(0); | 287 | jQuery("#live-posts").scrollTop(0); |
288 | } | 288 | } |
289 | else { | 289 | else { |
290 | jQuery("#live-posts").scrollTop(live_scroll_position); | 290 | jQuery("#live-posts").scrollTop(live_scroll_position); |
291 | } | 291 | } |
292 | - if (first_hub_load) { | ||
293 | - jQuery("body").removeClass("hub-loading"); | ||
294 | - first_hub_load = false; | ||
295 | - } | ||
296 | } | 292 | } |
297 | - }, | ||
298 | - error: function(ajax, stat, errorThrown) { | 293 | + |
294 | + if (first_hub_load) { | ||
295 | + jQuery("body").removeClass("hub-loading"); | ||
296 | + first_hub_load = false; | ||
297 | + } | ||
298 | + | ||
299 | } | 299 | } |
300 | }); | 300 | }); |
301 | 301 | ||
302 | } | 302 | } |
303 | - | ||
304 | - if (recursive) { | ||
305 | - setTimeout(function() { | ||
306 | - update_live_stream(true); | ||
307 | - }, 5000); | ||
308 | - } | ||
309 | - | ||
310 | } | 303 | } |
311 | 304 | ||
312 | function hub_left_tab_click() { | 305 | function hub_left_tab_click() { |
@@ -333,7 +326,8 @@ first_hub_load = true; | @@ -333,7 +326,8 @@ first_hub_load = true; | ||
333 | first_mediations_load = true; | 326 | first_mediations_load = true; |
334 | 327 | ||
335 | jQuery(".hub .envelope").scroll(function() { | 328 | jQuery(".hub .envelope").scroll(function() { |
336 | - jQuery("#auto_scrolling").attr('checked', false); | 329 | + jQuery("#auto_scrolling").prop('checked', false); |
330 | + | ||
337 | 331 | ||
338 | // live stream tab... | 332 | // live stream tab... |
339 | if (jQuery("#left-tab.show").size() != 0) { | 333 | if (jQuery("#left-tab.show").size() != 0) { |
@@ -367,6 +361,6 @@ jQuery(document).ready(function() { | @@ -367,6 +361,6 @@ jQuery(document).ready(function() { | ||
367 | 361 | ||
368 | jQuery("body").addClass("hub-loading"); | 362 | jQuery("body").addClass("hub-loading"); |
369 | 363 | ||
370 | - message_interval_id = setInterval(function() { update_live_stream(false) }, 5000); | 364 | + message_interval_id = setInterval(function() { update_live_stream() }, 5000); |
371 | 365 | ||
372 | }); | 366 | }); |
plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb
plugins/community_hub/views/content_viewer/hub.rhtml
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | <div id="input-panel"> | 28 | <div id="input-panel"> |
29 | <div class="form-message"> | 29 | <div class="form-message"> |
30 | 30 | ||
31 | - <% form_for :message, | 31 | + <%= form_for :message, |
32 | :method => 'post', | 32 | :method => 'post', |
33 | :url => { | 33 | :url => { |
34 | :controller => 'community_hub_plugin_public', | 34 | :controller => 'community_hub_plugin_public', |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | 66 | ||
67 | <%= render :file => 'shared/tiny_mce' %> | 67 | <%= render :file => 'shared/tiny_mce' %> |
68 | 68 | ||
69 | - <% form_for :article, | 69 | + <%= form_for :article, |
70 | :method => 'post', | 70 | :method => 'post', |
71 | :url => { | 71 | :url => { |
72 | :controller => 'community_hub_plugin_public', | 72 | :controller => 'community_hub_plugin_public', |