diff options
author | Byron Jones <glob@mozilla.com> | 2014-06-16 09:46:58 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-06-16 09:46:58 +0200 |
commit | 384a1c6564bda9386c7488cb299289c3fbb81f3c (patch) | |
tree | 91d8b3e0bf05ff3f10d4920c9dc8721f19939f0a | |
parent | 80c434b3c9afec9ba606e5061ef042d3b96720d3 (diff) | |
download | bugzilla-384a1c6564bda9386c7488cb299289c3fbb81f3c.tar.gz bugzilla-384a1c6564bda9386c7488cb299289c3fbb81f3c.tar.xz |
Bug 956892: collapsed comments should display tags to indicate the reason for auto-collapsing
r=gerv,a=sgreen
-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 | 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 %] <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 == 0 %]"> [% IF comment.count == 0 %] @@ -115,6 +116,9 @@ <div class="[% class_name FILTER html %]"> [% IF mode == "edit" %] <span class="bz_comment_actions"> + [% IF comment.collapsed %] + <span class="bz_collapsed_actions"> + [% END %] [% IF bug.check_can_change_field('longdesc', 0, 1) %] [% IF user.can_tag_comments %] [<a href="#" @@ -126,6 +130,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> @@ -173,6 +186,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 && @@ -184,7 +205,7 @@ [% IF user.id && Param('comment_taggers_group') %] <div id="comment_tag_[% comment.count FILTER html %]" - class="bz_comment_tags[% " collapsed" IF comment.collapsed %]"> + class="bz_comment_tags"> <span id="ct_[% comment.count %]" class="[% 'bz_default_hidden' UNLESS comment.tags.size %]"> [% IF comment.tags.size %] @@ -205,7 +226,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> </div> |