diff options
author | Byron Jones <glob@mozilla.com> | 2015-04-07 07:25:13 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-04-07 07:25:13 +0200 |
commit | 2c9db0144d3b3816bbfbfd821657ff0daf3687d5 (patch) | |
tree | ac7b758b080e980138d6c869b7f24e7df475863b /extensions | |
parent | 280c184398d4e4de9c00c96ee9dff1d7e6724615 (diff) | |
download | bugzilla-2c9db0144d3b3816bbfbfd821657ff0daf3687d5.tar.gz bugzilla-2c9db0144d3b3816bbfbfd821657ff0daf3687d5.tar.xz |
Bug 1149796: "Reset Assignee to default" and "Reset QA Contact to default" options missing when changing a bug's component
Diffstat (limited to 'extensions')
5 files changed, 89 insertions, 18 deletions
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 e198a8706..29b2a1e40 100644 --- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl @@ -414,6 +414,7 @@ [% WRAPPER bug_modal/field.html.tmpl field = bug_fields.assigned_to field_type = constants.FIELD_TYPE_USER + hide_on_edit = 1 %] [% IF unassigned %] <i>Unassigned</i> @@ -424,6 +425,18 @@ [% INCLUDE bug_modal/user.html.tmpl u=bug.assigned_to %] [% END %] [% END %] + [% WRAPPER bug_modal/field.html.tmpl + field = bug_fields.assigned_to + field_type = constants.FIELD_TYPE_USER + hide_on_view = 1 + append_content = 1 + %] + <div class="set-default-container" style="display:none"> + <input type="checkbox" id="set-default-assignee" name="set_default_assignee" class="set-default" + value="1" data-for="assigned_to"> + <label for="set-default-assignee">Reset Assignee to default</label> + </div> + [% END %] [%# mentors %] [% WRAPPER bug_modal/field.html.tmpl @@ -449,9 +462,22 @@ field = bug_fields.qa_contact field_type = constants.FIELD_TYPE_USER hide_on_view = bug.qa_contact == "" + hide_on_edit = 1 %] [% INCLUDE bug_modal/user.html.tmpl u=bug.qa_contact %] [% END %] + [% WRAPPER bug_modal/field.html.tmpl + field = bug_fields.qa_contact + field_type = constants.FIELD_TYPE_USER + hide_on_view = 1 + append_content = 1 + %] + <div class="set-default-container" style="display:none"> + <input type="checkbox" id="set-default-qa-contact" name="set_default_qa_contact" class="set-default" + value="1" data-for="qa_contact"> + <label for="set-default-qa-contact">Reset QA Contact to default</label> + </div> + [% END %] [% END %] [% WRAPPER fields_rhs %] diff --git a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl index 2d2cb56cf..787b8d9f1 100644 --- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl @@ -22,6 +22,8 @@ # short_width: (boolean) the field shouldn't take up much space at all (default: false) # hide_on_view: (boolean) hide field from read-only view (default: false) # hide_on_edit: (boolean) hide content when in edit mode (default: false) + # append_content: (boolean) when called as a WRAPPER, the content will be appended to the + # edit html instead of replacing it. forces edit_only (default: false); #%] [% @@ -43,6 +45,9 @@ END; IF !editable.defined; editable = bug.check_can_change_field(name, 0, 1); END; +IF append_content; + edit_only = 1; +END; IF inline && !label.defined; no_label = 1; END; @@ -248,6 +253,10 @@ END; ('[% name FILTER html %]' [[% field_type FILTER html %])] not supported) [% END %] + + [% IF append_content && content.defined %] + [% content FILTER none %] + [% END %] </div> [% END %] </div> diff --git a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl index c6dd8b74c..70c98641f 100644 --- a/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl +++ b/extensions/BugModal/template/en/default/bug_modal/header.html.tmpl @@ -97,4 +97,8 @@ zoom_textareas: [% user.settings.zoom_textareas.value == "on" ? "true" : "false" %] } }; + [% IF user.id %] + BUGZILLA.default_assignee = '[% bug.component_obj.default_assignee.login FILTER js %]'; + BUGZILLA.default_qa_contact = '[% bug.component_obj.default_qa_contact.login FILTER js %]'; + [% END %] [% END %] diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css index 85bae0e9d..19c2854bb 100644 --- a/extensions/BugModal/web/bug_modal.css +++ b/extensions/BugModal/web/bug_modal.css @@ -629,6 +629,10 @@ td.flag-requestee { color: #888; } +input[type=text][disabled], input:not([type])[disabled] { + color: #888 !important; +} + .xdsoft_datetimepicker button, .xdsoft_datetimepicker button:hover { -webkit-box-shadow: none; -moz-box-shadow: none; diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index 46050a72a..f39e48575 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -27,28 +27,44 @@ $(function() { ); } + // expand/collapse module + function slide_module(module, action) { + var latch = module.find('.module-latch'); + var spinner = $(latch.children('.module-spinner')[0]); + var content = $(module.children('.module-content')[0]); + + function slide_done() { + spinner.html(content.is(':visible') ? '▾' : '▸'); + } + if (action == 'show') { + content.slideDown(200, 'swing', slide_done); + } + else if (action == 'hide') { + content.slideUp(200, 'swing', slide_done); + } + else { + content.slideToggle(200, 'swing', slide_done); + } + } + // expand all modules $('#expand-all-btn') .click(function(event) { event.preventDefault(); var btn = $(event.target); if (btn.data('expanded-modules')) { - btn.data('expanded-modules').slideToggle(200, 'swing', function() { - btn.data('expanded-spinners').html('▸'); - }); + var modules = btn.data('expanded-modules'); btn.data('expanded-modules', false); + modules.each(function() { + slide_module($(this).parent('.module')); + }); btn.text('Expand All'); } else { var modules = $('.module-content:hidden'); - var spinners = $([]); - modules.each(function() { - spinners.push($(this).parent('.module').find('.module-spinner')[0]); - }); btn.data('expanded-modules', modules); - btn.data('expanded-spinners', spinners); - modules.slideToggle(200, 'swing', function() { - spinners.html('▾'); + modules.each(function() { + slide_module($(this).parent('.module')); }); btn.text('Collapse'); } @@ -58,14 +74,7 @@ $(function() { $('.module-header') .click(function(event) { event.preventDefault(); - var target = $(event.target); - var latch = target.hasClass('module-header') ? target.children('.module-latch') : target.parent('.module-latch'); - var spinner = $(latch.children('.module-spinner')[0]); - var module = $(latch.parents('.module')[0]); - var content = $(module.children('.module-content')[0]); - content.slideToggle(200, 'swing', function() { - spinner.html(content.is(':visible') ? '▾' : '▸'); - }); + slide_module($(this).parents('.module')); }); // toggle obsolete attachments @@ -685,6 +694,25 @@ $(function() { ] }); + // "reset to default" checkboxes + $('#product, #component') + .change(function(event) { + $('.set-default-container').show(); + $('#set-default-assignee').prop('checked', $('#assigned_to').val() == BUGZILLA.default_assignee).change(); + $('#set-default-qa-contact').prop('checked', $('#qa_contact').val() == BUGZILLA.default_qa_contact).change(); + slide_module($('#module-people'), 'show'); + }); + $('.set-default') + .change(function(event) { + var cb = $(event.target); + var input = $('#' + cb.data('for')); + input.attr('disabled', cb.prop('checked')); + if (!cb.prop('checked')) { + input.focus(); + input.select(); + } + }) + .change(); }); function confirmUnsafeURL(url) { |