diff options
author | Byron Jones <glob@mozilla.com> | 2014-06-16 09:57:42 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-06-16 09:57:42 +0200 |
commit | dd10df6857319589e15cc404ad8690cdf54a6768 (patch) | |
tree | f205759b650de1f72727c0b6dbcf8545e472d9af | |
parent | 9916f57f9b56b50aaa82cdfa8fdd6a0c2d46f5d2 (diff) | |
download | bugzilla-dd10df6857319589e15cc404ad8690cdf54a6768.tar.gz bugzilla-dd10df6857319589e15cc404ad8690cdf54a6768.tar.xz |
Bug 956892: collapsed comments should display tags to indicate the reason for auto-collapsing
-rw-r--r-- | js/comments.js | 8 | ||||
-rw-r--r-- | skins/standard/global.css | 15 | ||||
-rw-r--r-- | 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 %] <div id="c[% comment.count %]" class="bz_comment[% " bz_private" IF comment.is_private %] + [% " bz_default_collapsed" IF comment.collapsed %] [% " bz_comment_hilite" IF marks.${comment.count} %] [% " bz_first_comment" IF comment.count == description %]"> [% IF comment.count == 0 %] @@ -169,6 +170,9 @@ [% IF mode == "edit" %] <span class="bz_comment_actions"> + [% IF comment.collapsed %] + <span class="bz_collapsed_actions"> + [% END %] [% IF comment_text.search("(?:^>|\n>)") %] [<a class="bz_wrap_link" href="#" onclick="return toggleCommentWrap(this, [% comment.count %])">wrap</a>] @@ -184,6 +188,15 @@ [% END %] >reply</a>] [% END %] + [% IF comment.collapsed %] + </span> + [% END %] + <script type="text/javascript"> + addCollapseLink([% comment.count %], [% comment.collapsed FILTER js %], 'Toggle comment display'); + </script> + </span> + [% ELSIF comment.collapsed %] + <span class="bz_comment_actions"> <script type="text/javascript"> addCollapseLink([% comment.count %], [% comment.collapsed FILTER js %], 'Toggle comment display'); </script> @@ -234,6 +247,14 @@ <span class="bz_comment_time"> [%+ comment.creation_ts FILTER time %] </span> + + [% IF comment.collapsed %] + <span id="cr[% comment.count %]" class="bz_comment_collapse_reason" + title="[% comment.author.name || comment.author.login FILTER html %] + [%~ %] [[% comment.creation_ts FILTER time %]]"> + Comment hidden ([% comment.tags.join(', ') FILTER html %]) + </span> + [% END %] </div> [% IF user.is_timetracker && @@ -245,8 +266,8 @@ [% IF user.id && Param('comment_taggers_group') %] <div id="comment_tag_[% comment.count FILTER html %]" - class="bz_comment_tags[% " collapsed" IF comment.collapsed %] - [% " bz_default_hidden" UNLESS comment.tags.size %]"> + class="bz_comment_tags + [% " bz_default_hidden" UNLESS comment.tags.size %]"> <span id="ct_[% comment.count %]"> [% IF comment.tags.size %] <script> @@ -266,7 +287,9 @@ # generated HTML #%] <pre class="bz_comment_text[% " collapsed" IF comment.collapsed %]" - [% ' id="comment_text_' _ comment.count _ '"' IF mode == "edit" %]> + [% IF mode == "edit" || comment.collapsed %] + id="comment_text_[% comment.count FILTER none %]" + [% END %]> [%- comment_text FILTER quoteUrls(bug, comment) -%] </pre> [% Hook.process('a_comment-end', 'bug/comments.html.tmpl') %] |