diff options
author | Byron Jones <glob@mozilla.com> | 2015-10-12 06:53:40 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-10-12 06:53:40 +0200 |
commit | c2364b357634e07c1b709c5cb120181ae3bc5e65 (patch) | |
tree | c47823a345d76a4112522905c8ce03bfa804f1e2 /extensions | |
parent | 0c703a9d3b3ede6728b0fff7a979f48ce22adbb9 (diff) | |
download | bugzilla-c2364b357634e07c1b709c5cb120181ae3bc5e65.tar.gz bugzilla-c2364b357634e07c1b709c5cb120181ae3bc5e65.tar.xz |
Bug 1150358 - cannot remove other people from the cc list
Diffstat (limited to 'extensions')
6 files changed, 66 insertions, 5 deletions
diff --git a/extensions/BugModal/lib/WebService.pm b/extensions/BugModal/lib/WebService.pm index 2461cf2fa..e85225f60 100644 --- a/extensions/BugModal/lib/WebService.pm +++ b/extensions/BugModal/lib/WebService.pm @@ -127,8 +127,9 @@ sub cc { my $template = Bugzilla->template; my $bug = Bugzilla::Bug->check({ id => $params->{id} }); my $vars = { + bug => $bug, cc_list => [ - sort { lc($a->moz_nick) cmp lc($b->moz_nick) } + sort { lc($a->identity) cmp lc($b->identity) } @{ $bug->cc_users } ] }; diff --git a/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl index 37f582e0e..ceb6e3b62 100644 --- a/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/cc_list.html.tmpl @@ -9,8 +9,20 @@ [% UNLESS cc_list.size; 'None'; - END; - FOREACH cc IN cc_list; - INCLUDE bug_modal/user.html.tmpl u=cc; + RETURN; END; %] + +[% FOREACH cc IN cc_list %] + <div class="cc-user" data-n="[% loop.count FILTER none %]"> + [% IF bug.user.canedit %] + <a href="#" id="ccr-[% loop.count FILTER none %]" class="cc-remove" + data-n="[% loop.count FILTER none %]" data-login="[% cc.login FILTER html %]" + title="Remove" style="visibility:hidden"> ✖ </a> + [% END %] + [% INCLUDE bug_modal/user.html.tmpl + u = cc + id = "ccu-" _ loop.count + %] + </div> +[% END %] diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl index 5d148a7dd..ddf37a26c 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -617,6 +617,7 @@ [% END %] [% IF bug.cc && bug.cc.size %] + <input type="hidden" name="removecc" id="removecc"> <span id="cc-latch">▸</span> <span id="cc-summary"> [% diff --git a/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl index 062276614..4c28936cc 100644 --- a/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl @@ -12,6 +12,7 @@ # gravatar_size : size of the gravator icon (default 0, which disables the gravatar) # gravatar_only : boolean, if true output just the gravatar (not-simple only) # nick_only : boolean, if true, the nickname will be used instead of the full name + # id : string, if provided the id of the vcard div #%] [% @@ -24,7 +25,7 @@ IF user.settings.show_gravatars.value != 'On'; gravatar_size = 0; END; %] -<div class="vcard vcard_[% u.id FILTER none %]"> +<div class="vcard vcard_[% u.id FILTER none %]" [% IF id %]id="[% id FILTER html %]"[% END %]> [% FILTER collapse %] [% IF simple %] diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index 21d8a34d0..9090945d3 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -323,6 +323,23 @@ input[type="number"] { max-height: 150px; overflow-y: auto; clear: both; + white-space: nowrap; +} + +#cc-list .vcard { + display: inline-block; +} + +#cc-list button { + padding: 2px 4px; +} + +.cc-remove { + font-size: 120%; +} + +.cc-removed { + text-decoration: line-through; } #add-cc-btn { diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index 098450cd9..74ee83312 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -166,6 +166,35 @@ $(function() { function(data) { $('#cc-list').html(data.html); latch.data('fetched', true); + $('#cc-list .cc-user').hover( + function() { + $('#ccr-' + $(this).data('n')).css('visibility', 'visible'); + }, + function() { + $('#ccr-' + $(this).data('n')).css('visibility', 'hidden'); + } + ); + $('#cc-list .cc-remove') + .click(function(event) { + event.preventDefault(); + $('#top-save-btn').show(); + var n = $(this).data('n'); + var ccu = $('#ccu-' + n); + if (ccu.hasClass('cc-removed')) { + ccu.removeClass('cc-removed'); + $('#cc-' + n).remove(); + } + else { + $('#removecc').val('on'); + ccu.addClass('cc-removed'); + $('<input>').attr({ + type: 'hidden', + id: 'cc-' + n, + value: $('#ccr-' + n).data('login'), + name: 'cc' + }).appendTo('#changeform'); + } + }); } ); } |