From 384a1c6564bda9386c7488cb299289c3fbb81f3c Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 16 Jun 2014 15:46:58 +0800 Subject: Bug 956892: collapsed comments should display tags to indicate the reason for auto-collapsing r=gerv,a=sgreen --- js/comments.js | 8 +++++--- skins/standard/global.css | 15 ++++++++++++++- template/en/default/bug/comments.html.tmpl | 27 +++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/js/comments.js b/js/comments.js index 9150c72ec..43e6fe96e 100644 --- a/js/comments.js +++ b/js/comments.js @@ -23,11 +23,11 @@ function updateCommentPrivacy(checkbox, id) { function toggle_comment_display(link, comment_id) { var comment = document.getElementById('comment_text_' + comment_id); - var re = new RegExp(/\bcollapsed\b/); - if (comment.className.match(re)) + if (YAHOO.util.Dom.hasClass(comment, 'collapsed')) { expand_comment(link, comment, comment_id); - else + } else { collapse_comment(link, comment, comment_id); + } } function toggle_all_comments(action) { @@ -61,6 +61,8 @@ function collapse_comment(link, comment, comment_id) { function expand_comment(link, comment, comment_id) { link.innerHTML = "[−]"; + YAHOO.util.Dom.addClass('cr' + comment_id, 'collapsed'); + YAHOO.util.Dom.removeClass('c' + comment_id, 'bz_default_collapsed'); YAHOO.util.Dom.removeClass(comment, 'collapsed'); YAHOO.util.Dom.removeClass('comment_tag_' + comment_id, 'collapsed'); } diff --git a/skins/standard/global.css b/skins/standard/global.css index 848cafe04..74005319a 100644 --- a/skins/standard/global.css +++ b/skins/standard/global.css @@ -372,6 +372,11 @@ div#docslinks { padding: 1em 0; } +.bz_comment_collapse_reason, +.bz_default_collapsed .bz_comment_number { + font-weight: normal; +} + /** End Comments **/ .bz_default_hidden, .bz_tui_hidden, .bz_hidden_field, .bz_hidden_option { @@ -558,7 +563,15 @@ div.user_match { padding: 0.5em 1em; } -.collapsed { +.collapsed, +.bz_default_collapsed .bz_private_checkbox, +.bz_default_collapsed .bz_comment_user, +.bz_default_collapsed .bz_comment_user_images, +.bz_default_collapsed .bz_comment_time, +.bz_default_collapsed .bz_comment_tags, +.bz_default_collapsed .bz_comment_text, +.bz_default_collapsed .bz_collapsed_actions +{ display: none; } diff --git a/template/en/default/bug/comments.html.tmpl b/template/en/default/bug/comments.html.tmpl index ea3cfd0de..314269227 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -102,6 +102,7 @@ [% RETURN IF comment_text == '' AND (comment.work_time - 0) != 0 AND !user.is_timetracker %]
[% IF comment.count == 0 %] @@ -115,6 +116,9 @@
[% IF mode == "edit" %] + [% IF comment.collapsed %] + + [% END %] [% IF bug.check_can_change_field('longdesc', 0, 1) %] [% IF user.can_tag_comments %] [reply] [% END %] + [% IF comment.collapsed %] + + [% END %] + + + [% ELSIF comment.collapsed %] + @@ -173,6 +186,14 @@ [%+ comment.creation_ts FILTER time %] + + [% IF comment.collapsed %] + + Comment hidden ([% comment.tags.join(', ') FILTER html %]) + + [% END %]
[% IF user.is_timetracker && @@ -184,7 +205,7 @@ [% IF user.id && Param('comment_taggers_group') %]
+ class="bz_comment_tags"> [% IF comment.tags.size %] @@ -205,7 +226,9 @@ # generated HTML #%]
+  [% IF mode == "edit" || comment.collapsed %]
+    id="comment_text_[% comment.count FILTER none %]"
+  [% END %]>
   [%- comment_text FILTER quoteUrls(bug, comment) -%]
 
-- cgit v1.2.3-24-g4f1b