From 331aa1ff60319a751dc55076a544ae6a9efb99a7 Mon Sep 17 00:00:00 2001 From: MrZYX Date: Thu, 19 May 2011 20:10:35 +0200 Subject: [PATCH] you know the facepalm smiley? Here it is: m( --- app/helpers/comments_helper.rb | 6 ++++-- config/locales/javascript/javascript.en.yml | 3 +++ public/javascripts/stream.js | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 0df7ee28f..ecb2ce2ed 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -6,10 +6,12 @@ module CommentsHelper GSUB_THIS = "FIUSDHVIUSHDVIUBAIUHAPOIUXJM" def comment_toggle(count, commenting_disabled=false) if count <= 3 - link_to "#{t('stream_helper.hide_comments')} (#{count})", '#', :class => "show_post_comments" + str = link_to "#{t('stream_helper.hide_comments')}", '#', :class => "show_post_comments" else - link_to "#{t('stream_helper.show_comments')} (#{count})", '#', :class => "show_post_comments" + str = link_to "#{t('stream_helper.show_comments')}", '#', :class => "show_post_comments" end + str << " (#{count})" + str end def new_comment_form(post_id, current_user) diff --git a/config/locales/javascript/javascript.en.yml b/config/locales/javascript/javascript.en.yml index aeae88c95..41e44f1db 100644 --- a/config/locales/javascript/javascript.en.yml +++ b/config/locales/javascript/javascript.en.yml @@ -44,3 +44,6 @@ en: show_more: "show more" failed_to_like: "Failed to like!" failed_to_post_message: "Failed to post message!" + comments: + show: "show all comments" + hide: "hide comments" diff --git a/public/javascripts/stream.js b/public/javascripts/stream.js index b018cf95b..9d8813943 100644 --- a/public/javascripts/stream.js +++ b/public/javascripts/stream.js @@ -132,25 +132,25 @@ var Stream = { text = $this.html(), showUl = $(this).closest('li'), commentBlock = $this.closest(".stream_element").find("ul.comments", ".content"), - commentBlockMore = $this.closest(".stream_element").find(".older_comments", ".content"), - show = (text.indexOf("show") != -1); + commentBlockMore = $this.closest(".stream_element").find(".older_comments", ".content") if( commentBlockMore.hasClass("inactive") ) { commentBlockMore.fadeIn(150, function() { commentBlockMore.removeClass("inactive"); commentBlockMore.removeClass("hidden"); }); + $this.html(Diaspora.widgets.i18n.t('comments.hide')); } else { if(commentBlock.hasClass("hidden")) { commentBlock.removeClass('hidden'); showUl.css('margin-bottom','-1em'); + $this.html(Diaspora.widgets.i18n.t('comments.hide')); }else{ commentBlock.addClass('hidden'); showUl.css('margin-bottom','1em'); + $this.html(Diaspora.widgets.i18n.t('comments.show')); } } - - $this.html(text.replace((show) ? "show" : "hide", (show) ? "hide" : "show")); }, focusNewComment: function(toggle, evt) {