From 2c9db0144d3b3816bbfbfd821657ff0daf3687d5 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Tue, 7 Apr 2015 13:25:13 +0800 Subject: Bug 1149796: "Reset Assignee to default" and "Reset QA Contact to default" options missing when changing a bug's component --- extensions/BugModal/web/bug_modal.css | 4 +++ extensions/BugModal/web/bug_modal.js | 64 +++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 18 deletions(-) (limited to 'extensions/BugModal/web') 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) { -- cgit v1.2.3-24-g4f1b