diff options
author | Byron Jones <glob@mozilla.com> | 2015-06-05 09:30:41 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-06-05 09:30:41 +0200 |
commit | cf55aa5ea49a62a2bdf9f99a5cb10821aba17ed3 (patch) | |
tree | f935ea74679a885e6c0cf8e6045996254caa1695 /extensions/BugModal/web | |
parent | ffd0e306e87976b962f6e60e8885d1d611fedd37 (diff) | |
download | bugzilla-cf55aa5ea49a62a2bdf9f99a5cb10821aba17ed3.tar.gz bugzilla-cf55aa5ea49a62a2bdf9f99a5cb10821aba17ed3.tar.xz |
Bug 1170004: Pressing back after a bug submission error leaves the "Save Changes" button greyed out
Diffstat (limited to 'extensions/BugModal/web')
-rw-r--r-- | extensions/BugModal/web/bug_modal.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js index 87cfcffdf..38b19ac53 100644 --- a/extensions/BugModal/web/bug_modal.js +++ b/extensions/BugModal/web/bug_modal.js @@ -48,6 +48,23 @@ $(function() { } } + // restore edit mode after navigating back + function restoreEditMode() { + if (!$('#editing').val()) + return; + $('.module') + .each(function() { + slide_module($(this), 'hide', true); + }); + $($('#editing').val().split(' ')) + .each(function() { + slide_module($('#' + this), 'show', true); + }); + $('#mode-btn').click(); + $('.save-btn').prop('disabled', false); + $('#editing').val(''); + } + // expand all modules $('#expand-all-btn') .click(function(event) { @@ -996,18 +1013,8 @@ $(function() { }); // finally switch to edit mode if we navigate back to a page that was editing - if ($('#editing').val()) { - $('.module') - .each(function() { - slide_module($(this), 'hide', true); - }); - $($('#editing').val().split(' ')) - .each(function() { - slide_module($('#' + this), 'show', true); - }); - $('#mode-btn').click(); - $('#editing').val(''); - } + $(window).on('pageshow', restoreEditMode); + restoreEditMode(); }); function confirmUnsafeURL(url) { |