From dd10df6857319589e15cc404ad8690cdf54a6768 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Mon, 16 Jun 2014 15:57:42 +0800 Subject: Bug 956892: collapsed comments should display tags to indicate the reason for auto-collapsing --- js/comments.js | 8 +++++--- skins/standard/global.css | 15 ++++++++++++++- template/en/default/bug/comments.html.tmpl | 29 ++++++++++++++++++++++++++--- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/js/comments.js b/js/comments.js index 63bf5c887..12bc00d46 100644 --- a/js/comments.js +++ b/js/comments.js @@ -38,11 +38,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) { @@ -76,6 +76,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 8e7799fb1..3a61dae83 100644 --- a/skins/standard/global.css +++ b/skins/standard/global.css @@ -350,6 +350,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 { @@ -475,7 +480,15 @@ div.user_match { display: inline-block; } -.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 ef3131a5e..8effb89da 100644 --- a/template/en/default/bug/comments.html.tmpl +++ b/template/en/default/bug/comments.html.tmpl @@ -155,6 +155,7 @@ [% RETURN IF comment_text == '' AND (comment.work_time - 0) != 0 AND !user.is_timetracker %]
[% IF comment.count == 0 %] @@ -169,6 +170,9 @@ [% IF mode == "edit" %] + [% IF comment.collapsed %] + + [% END %] [% IF comment_text.search("(?:^>|\n>)") %] [wrap] @@ -184,6 +188,15 @@ [% END %] >reply] [% END %] + [% IF comment.collapsed %] + + [% END %] + + + [% ELSIF comment.collapsed %] + @@ -234,6 +247,14 @@ [%+ comment.creation_ts FILTER time %] + + [% IF comment.collapsed %] + + Comment hidden ([% comment.tags.join(', ') FILTER html %]) + + [% END %]
[% IF user.is_timetracker && @@ -245,8 +266,8 @@ [% IF user.id && Param('comment_taggers_group') %]
+ class="bz_comment_tags + [% " bz_default_hidden" UNLESS comment.tags.size %]"> [% IF comment.tags.size %]