diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb index c109181..e16a809 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub.rb @@ -5,12 +5,19 @@ class CommunityHubPlugin::Hub < Folder attr_accessible :last_changed_by_id, :integer + attr_accessible :twitter_enabled, :type => :booelan, :default => false + attr_accessible :twitter_hashtags, :type => :string, :default => "" + attr_accessible :twitter_consumer_key, :type => :string, :default => "" + attr_accessible :twitter_consumer_secret, :type => :string, :default => "" + attr_accessible :twitter_access_token, :type => :string, :default => "" + attr_accessible :twitter_access_token_secret, :type => :string, :default => "" + settings_items :twitter_enabled, :type => :boolean, :default => false settings_items :twitter_hashtags, :type => :string, :default => "" - settings_items :twitter_consumer_key, :type => :string, :default => "" - settings_items :twitter_consumer_secret, :type => :string, :default => "" - settings_items :twitter_access_token, :type => :string, :default => "" - settings_items :twitter_access_token_secret, :type => :string, :default => "" + settings_items :twitter_consumer_key, :type => :string, :default => "" + settings_items :twitter_consumer_secret, :type => :string, :default => "" + settings_items :twitter_access_token, :type => :string, :default => "" + settings_items :twitter_access_token_secret, :type => :string, :default => "" settings_items :facebook_enabled, :type => :boolean, :default => false settings_items :facebook_page_id, :type => :string, :default => "" settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds diff --git a/plugins/community_hub/public/javascripts/community_hub.js b/plugins/community_hub/public/javascripts/community_hub.js index c4b6d1e..86bc1b4 100644 --- a/plugins/community_hub/public/javascripts/community_hub.js +++ b/plugins/community_hub/public/javascripts/community_hub.js @@ -103,12 +103,12 @@ function new_message(button) { if (data.ok) { jQuery(".hub .form-message #message_body").val(''); jQuery(".hub .form-message .submit").attr("disabled", false); - update_live_stream(false); - message_interval_id = setInterval(function() { update_live_stream(false)}, 5000); + update_live_stream(); + message_interval_id = setInterval(function() { update_live_stream()}, 5000); } else { jQuery(".hub .form-message .submit").attr("disabled", false); - message_interval_id = setInterval(function() { update_live_stream(false)}, 5000); + message_interval_id = setInterval(function() { update_live_stream()}, 5000); } }, 'json'); @@ -263,8 +263,7 @@ function update_mediations() { } -function update_live_stream(recursive) { - +function update_live_stream() { if (jQuery("#left-tab.show").size() != 0) { var hub_id = jQuery(".hub").attr('id'); @@ -281,32 +280,26 @@ function update_live_stream(recursive) { type: 'get', data: { latest_post: latest_post_id, hub: hub_id }, success: function(data) { + if (data.trim().length > 0) { jQuery("#live-posts").prepend(data); - if (jQuery("#auto_scrolling").attr('checked')) { + if (jQuery("#auto_scrolling").prop('checked', true)) { jQuery("#live-posts").scrollTop(0); } else { jQuery("#live-posts").scrollTop(live_scroll_position); } - if (first_hub_load) { - jQuery("body").removeClass("hub-loading"); - first_hub_load = false; - } } - }, - error: function(ajax, stat, errorThrown) { + + if (first_hub_load) { + jQuery("body").removeClass("hub-loading"); + first_hub_load = false; + } + } }); } - - if (recursive) { - setTimeout(function() { - update_live_stream(true); - }, 5000); - } - } function hub_left_tab_click() { @@ -333,7 +326,8 @@ first_hub_load = true; first_mediations_load = true; jQuery(".hub .envelope").scroll(function() { - jQuery("#auto_scrolling").attr('checked', false); + jQuery("#auto_scrolling").prop('checked', false); + // live stream tab... if (jQuery("#left-tab.show").size() != 0) { @@ -367,6 +361,6 @@ jQuery(document).ready(function() { jQuery("body").addClass("hub-loading"); - message_interval_id = setInterval(function() { update_live_stream(false) }, 5000); + message_interval_id = setInterval(function() { update_live_stream() }, 5000); }); diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb index 3579fac..9f0924d 100644 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb +++ b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb @@ -1,4 +1,4 @@ -<% form_for :message, +<%= form_for :message, :method => 'post', :url => { :controller => 'community_hub_plugin_public', diff --git a/plugins/community_hub/views/content_viewer/hub.rhtml b/plugins/community_hub/views/content_viewer/hub.rhtml index 60d05fa..1b82023 100644 --- a/plugins/community_hub/views/content_viewer/hub.rhtml +++ b/plugins/community_hub/views/content_viewer/hub.rhtml @@ -28,7 +28,7 @@