diff --git a/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb b/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb index 48b0168..dee3047 100644 --- a/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb +++ b/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb @@ -53,10 +53,12 @@ class CommunityHubPluginPublicController < PublicController def newer_mediation_comment latest_id = params[:latest_post] mediation = params[:mediation] - comments = Comment.find(:all, :conditions => ["id > :id and source_id = :mediation", { - :id => latest_id, - :mediation => mediation - }]) + comments = Comment.find(:all, + :limit => 100, + :conditions => ["id > :id and source_id = :mediation", { + :id => latest_id, + :mediation => mediation + }]) render :partial => "mediation_comment", :collection => comments @@ -67,8 +69,12 @@ class CommunityHubPluginPublicController < PublicController latest_post = params[:latest_post] hub = Article.find(params[:hub]) posts = Comment.find(:all, - :order => "id desc", - :conditions => ["id > ?", latest_post]) + :order => "id desc", + :limit => 100, + :conditions => ["id > :id and source_id = :hub", { + :id => latest_post, + :hub => hub + }]) if !posts.empty? oldest_post = posts.last.id @@ -93,6 +99,7 @@ class CommunityHubPluginPublicController < PublicController hub = Article.find(params[:hub]) posts = Article.find(:all, :order => "id desc", + :limit => 100, :conditions => ["id > :id and type = :type and parent_id = :hub", { :id => latest_post, :type => 'TinyMceArticle', @@ -117,13 +124,6 @@ class CommunityHubPluginPublicController < PublicController end - def more_comments - @posts = Comment.find(:all) - render :partial => "post", :collection => @posts - end - - - def settings settings_section = params[:id] render :partial => "settings/twitter", :layout => true diff --git a/plugins/community_hub/public/javascripts/community_hub.js b/plugins/community_hub/public/javascripts/community_hub.js index 59b9272..bf1d94e 100644 --- a/plugins/community_hub/public/javascripts/community_hub.js +++ b/plugins/community_hub/public/javascripts/community_hub.js @@ -1,5 +1,6 @@ var latest_post_id = 0; var oldest_post_id = 0; +live_scroll_position = 0; function toogle_mediation_comments(mediation) { jQuery("#mediation-comment-list-" + mediation ).toggle(); @@ -153,7 +154,7 @@ function update_mediations() { } }); - setTimeout(update_mediations, 10000); + setTimeout(update_mediations, 7000); } @@ -176,6 +177,12 @@ function update_live_stream() { success: function(data) { if (data.trim().length > 0) { jQuery("#live-posts").prepend(data); + if (jQuery("#auto_scrolling").attr('checked')) { + jQuery("#live-posts").scrollTop(0); + } + else { + jQuery("#live-posts").scrollTop(live_scroll_position); + } } }, error: function(ajax, stat, errorThrown) { @@ -188,6 +195,10 @@ function update_live_stream() { jQuery(document).ready(function() { + jQuery("#live-posts").scroll(function() { + live_scroll_position = jQuery("#live-posts").scrollTop(); + }); + setTimeout(update_live_stream, 5000); - setTimeout(update_mediations, 10000); + setTimeout(update_mediations, 7000); }); \ No newline at end of file diff --git a/plugins/community_hub/public/style.css b/plugins/community_hub/public/style.css index ed1cd2f..30a81f4 100644 --- a/plugins/community_hub/public/style.css +++ b/plugins/community_hub/public/style.css @@ -32,10 +32,12 @@ } .hub .post { - border-bottom: 1px solid #ddd !important; - background: url("images/hub-time-bg.gif") repeat-y left top #fff; + border-bottom: 1px solid #ddd; + background: url("images/hub-time-bg.gif") repeat-y left top #fff; + padding: 5px 0; } + .hub .time{ display: inline-block; font-size: 8px; @@ -52,6 +54,12 @@ margin: 0 10px; vertical-align: top; width: 43px; + text-align: center; +} + +.hub .avatar img{ + max-height: 43px; + max-width: 43px; } .hub .message{ @@ -60,7 +68,11 @@ } .hub .message .author { - font-weight: bold; + font-weight: bold; + float: left; + display: inline-block; + line-height: 20px; + margin-right: 5px; } .hub .mediation-bar { @@ -118,6 +130,18 @@ float: right; } +.hub ul.mediation-comment-list{ + margin-left: 80px; + display: inline-block; + padding: 10px 0; + background-color: #fff; + margin-bottom: 10px; +} + +.hub ul.mediation-comment-list li{ + padding-left: 10px; +} + /**/ .hub .live { @@ -139,6 +163,15 @@ } +.hub #live-posts .post { + background-color:#fff; +} + +.hub ul#mediation-posts .post{ + background-color:#eee; + border-color: #fff; +} + #content .main-block .hub .live h1{ background-color: #f4f4f4; border: 1px solid lightGray @@ -288,3 +321,8 @@ .hub .settings .twitter, .hub .settings .facebook, .hub .settings .general { /* border: 1px solid red;*/ } + +textarea#message_body { + width: auto; + margin-left: 80px; +} \ No newline at end of file diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml b/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml index 42f4896..6de71f3 100644 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml +++ b/plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml @@ -37,7 +37,7 @@ <% total_mediation_comments = mediation.comments.count %> - + <%= link_to(_( "#{total_mediation_comments} Comments" ) , '#', :class => 'display-comment-form', :id => 'top-post-comment-button', diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.rhtml b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.rhtml index f216bd1..f8da03b 100644 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.rhtml +++ b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.rhtml @@ -5,8 +5,7 @@ :action => 'new_message', :article_id => mediation.id } do |f| %> - <%= f.text_area(:body, - :style => 'width: 97%;', + <%= f.text_area(:body, :rows => 4, :placeholder => _('Type your comment here')) %> <%= submit_button('add', _('Post'), :onclick => 'new_message(this); return false;') %> diff --git a/plugins/community_hub/views/community_hub_plugin_public/_post.rhtml b/plugins/community_hub/views/community_hub_plugin_public/_post.rhtml index ca76075..121a939 100644 --- a/plugins/community_hub/views/community_hub_plugin_public/_post.rhtml +++ b/plugins/community_hub/views/community_hub_plugin_public/_post.rhtml @@ -1,10 +1,10 @@ <% extend CommunityHubPlugin::HubHelper %> -
  • +
    • <%= post_time(post.created_at) %>
    • <%= image_tag(profile_icon(post.author, :minor)) %>
    • -
    • <%= post.author_name %>: <%= post.body %>
    • +
    • <%= post.author_name %>:

      <%= post.body %>

    • <% if mediator?(hub) %>
    • diff --git a/plugins/community_hub/views/content_viewer/hub.rhtml b/plugins/community_hub/views/content_viewer/hub.rhtml index dfc54ac..bf2667b 100644 --- a/plugins/community_hub/views/content_viewer/hub.rhtml +++ b/plugins/community_hub/views/content_viewer/hub.rhtml @@ -14,7 +14,7 @@
      - + <%= check_box_tag 'auto_scrolling', 'yes', true %><%= _("Auto scrolling") %>
      -- libgit2 0.21.2