MS DG only show three comments by default

This commit is contained in:
maxwell 2010-12-01 18:09:41 -08:00
parent ee47a2ffda
commit e18b918676
5 changed files with 21 additions and 6 deletions

View file

@ -5,7 +5,7 @@
module StreamHelper module StreamHelper
def comment_toggle(count) def comment_toggle(count)
if count > 0 if count < 3
link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments" link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments"
else else
link_to "#{t('stream_helper.show_comments')} (#{count})", '#', :class => "show_post_comments" link_to "#{t('stream_helper.show_comments')} (#{count})", '#', :class => "show_post_comments"

View file

@ -3,7 +3,7 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
- comment = hash[:comment] - comment = hash[:comment]
- person = hash[:person] - person = hash[:person]
%li.comment{:data=>{:guid=>comment.id}} %li.comment{:data=>{:guid=>comment.id}, :class => ("hidden" if(defined? hidden))}
=person_image_link(person) =person_image_link(person)
.content .content
.from .from

View file

@ -3,7 +3,12 @@
-# the COPYRIGHT file. -# the COPYRIGHT file.
%ul.comments{:id => post_id, :class => ("hidden" if comment_hashes.size == 0)} %ul.comments{:id => post_id, :class => ("hidden" if comment_hashes.size == 0)}
= render :partial => 'comments/comment', :collection => comment_hashes, :as => :hash -if comment_hashes.size > 3
.older_comments.hidden.inactive
= render :partial => 'comments/comment', :collection => comment_hashes[0..-3], :as => :hash
= render :partial => 'comments/comment', :collection => comment_hashes[-3, 3], :as => :hash
-else
= render :partial => 'comments/comment', :collection => comment_hashes, :as => :hash
%li.comment.show %li.comment.show
= render 'comments/new_comment', :post_id => post_id = render 'comments/new_comment', :post_id => post_id

View file

@ -434,7 +434,7 @@ en:
simplicity_explanation: "Diaspora makes sharing clean and easy and this goes for privacy too. Inherently private, Diaspora doesnt make you wade through pages of settings and options just to keep your profile secure." simplicity_explanation: "Diaspora makes sharing clean and easy and this goes for privacy too. Inherently private, Diaspora doesnt make you wade through pages of settings and options just to keep your profile secure."
learn_about_host: "Learn about how to host your own Diaspora server." learn_about_host: "Learn about how to host your own Diaspora server."
stream_helper: stream_helper:
show_comments: "show comments" show_comments: "show all comments"
hide_comments: "hide comments" hide_comments: "hide comments"
webfinger: webfinger:
fetch_failed: "failed to fetch webfinger profile for %{profile_url}" fetch_failed: "failed to fetch webfinger profile for %{profile_url}"

View file

@ -103,11 +103,21 @@ var Stream = {
var $this = $(this), var $this = $(this),
text = $this.html(), text = $this.html(),
commentBlock = $this.closest("li").find("ul.comments", ".content"), commentBlock = $this.closest("li").find("ul.comments", ".content"),
commentBlockMore = $this.closest("li").find(".older_comments", ".content"),
show = (text.indexOf("show") != -1); show = (text.indexOf("show") != -1);
commentBlock.fadeToggle(150, function() {
commentBlock.toggleClass("hidden"); if( commentBlockMore.hasClass("inactive") ) {
commentBlockMore.fadeIn(150, function(){
commentBlockMore.removeClass("inactive");
commentBlockMore.removeClass("hidden");
});
} else {
commentBlock.fadeToggle(150, function() {
commentBlock.toggleClass("hidden");
}); });
}
$this.html(text.replace((show) ? "show" : "hide", (show) ? "hide" : "show")); $this.html(text.replace((show) ? "show" : "hide", (show) ? "hide" : "show"));
} }
}; };