summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-11-12 05:34:38 +0100
committerByron Jones <glob@mozilla.com>2015-11-12 05:34:38 +0100
commit771547cd05b0266e4e0cf5682bb0e350f931a3bd (patch)
tree25fefa6ab151846c5ab16e4bfef667b69ade06a9 /extensions/BugModal
parentb4bfae7e1ece8c214e173865b1600c1f2ec11c9c (diff)
downloadbugzilla-771547cd05b0266e4e0cf5682bb0e350f931a3bd.tar.gz
bugzilla-771547cd05b0266e4e0cf5682bb0e350f931a3bd.tar.xz
Bug 1223669 - don't scroll to the top of the page when clicking on the resolution buttons
Diffstat (limited to 'extensions/BugModal')
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl99
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/field.html.tmpl5
-rw-r--r--extensions/BugModal/web/bug_modal.css7
-rw-r--r--extensions/BugModal/web/bug_modal.js55
4 files changed, 100 insertions, 66 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 a7eb2b7c6..c22c0a7f8 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -436,34 +436,41 @@
label = "Status"
hide_on_view = bug.assigned_to.id != user.id
%]
- [% INCLUDE bug_modal/field.html.tmpl
- field = bug_fields.bug_status
- field_type = constants.FIELD_TYPE_SINGLE_SELECT
- editable = bug.choices.bug_status.size > 1
- values = bug.choices.bug_status
- inline = 1
- no_indent = 1
- edit_only = 1
- %]
- [% INCLUDE bug_modal/field.html.tmpl
- field = bug_fields.resolution
- field_type = constants.FIELD_TYPE_SINGLE_SELECT
- editable = bug.choices.resolution.size > (bug.resolution == "" ? 0 : 1)
- values = bug.choices.resolution
- inline = 1
- edit_only = 1
- %]
- [% IF bug.choices.resolution.only("name", "DUPLICATE").size %]
- <div id="duplicate-container">
- of
- <input id="dup_id" name="dup_id" size="6" value="[% bug.dup_id FILTER html %]">
- </div>
- <div id="duplicate-actions">
- <button type="button" class="minor" id="mark-as-dup-btn">
- Mark as Duplicate
- </button>
- </div>
- [% END %]
+ [% INCLUDE status_block %]
+ [% END %]
+[% END %]
+
+[% BLOCK status_block %]
+ [% INCLUDE bug_modal/field.html.tmpl
+ prefix = prefix
+ field = bug_fields.bug_status
+ field_type = constants.FIELD_TYPE_SINGLE_SELECT
+ editable = bug.choices.bug_status.size > 1
+ values = bug.choices.bug_status
+ inline = 1
+ no_indent = 1
+ edit_only = 1
+ %]
+ [% INCLUDE bug_modal/field.html.tmpl
+ prefix = prefix
+ field = bug_fields.resolution
+ field_type = constants.FIELD_TYPE_SINGLE_SELECT
+ editable = bug.choices.resolution.size > (bug.resolution == "" ? 0 : 1)
+ values = bug.choices.resolution
+ inline = 1
+ edit_only = 1
+ %]
+ [% IF bug.choices.resolution.only("name", "DUPLICATE").size %]
+ <div id="[% prefix FILTER none %]duplicate-container">
+ of
+ <input id="[% prefix FILTER none %]dup_id" name="[% prefix FILTER none %]dup_id"
+ size="6" value="[% bug.dup_id FILTER html %]">
+ </div>
+ <div id="[% prefix FILTER none %]duplicate-actions">
+ <button type="button" class="minor" id="[% prefix FILTER none %]mark-as-dup-btn">
+ Mark as Duplicate
+ </button>
+ </div>
[% END %]
[% END %]
@@ -1096,21 +1103,31 @@
[% IF user.id %]
<div id="new-comment-actions">
<button type="submit" class="save-btn major" id="bottom-save-btn">Save Changes</button>
- [%
- IF bug.resolution == "";
- seen_header = 0;
- FOREACH resolution IN ["FIXED", "INVALID", "DUPLICATE"];
- NEXT UNLESS bug.choices.resolution.only("name", resolution).size;
- IF NOT seen_header;
- seen_header = 1;
- " Resolve as ";
+ <div id="resolve-as">
+ [%
+ IF bug.resolution == "";
+ seen_header = 0;
+ FOREACH resolution IN ["FIXED", "INVALID", "DUPLICATE"];
+ NEXT UNLESS bug.choices.resolution.only("name", resolution).size;
+ IF NOT seen_header;
+ seen_header = 1;
+ " Resolve as ";
+ END;
+ %] <button type="button" class="minor resolution-btn">[% resolution FILTER html %]</button> [%
+ END;
+ ELSE;
+ IF bug.choices.bug_status.only("name", "VERIFIED").size && bug.bug_status != "VERIFIED";
+ %] <button type="button" class="minor status-btn" data-status="VERIFIED">VERIFY</button> [%
+ END;
+ IF bug.choices.bug_status.only("name", "REOPENED").size;
+ %] <button type="button" class="minor status-btn" data-status="REOPENED">REOPEN</button> [%
END;
- %] <button type="button" class="minor resolution-btn">[% resolution FILTER html %]</button> [%
END;
- ELSIF bug.choices.bug_status.only("name", "REOPENED").size;
- %] <button type="button" class="minor status-btn" data-status="REOPENED">REOPEN</button> [%
- END;
- %]
+ %]
+ </div>
+ <div id="bottom-status" style="display:none">
+ [% INCLUDE status_block prefix="bottom-" %]
+ </div>
</div>
[% END %]
[% END %]
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 bbc7dbb00..b31052d36 100644
--- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
@@ -14,6 +14,8 @@
# view_only: (boolean) don't allow editing (default: determined from bug.check_can_change_field)
# edit_only: (boolean) always render the edit ui
# container: (boolean) output just a label and the content (eg. for multiple fields next to one label)
+ # name: (string) field name (default: field.name)
+ # prefix: (string) string to prepend to 'name' and 'id' attributes (default: empty)
# value: (string) visible value (default: bug.$name)
# values: (array of string) list of value objects (FIELD_TYPE_SINGLE_SELECT and _BUG_URLS only) (default: lazy-load on edit)
# inline: (boolean) output field as a table-cell instead of as a stand-alone div (default: false)
@@ -64,6 +66,9 @@ END;
IF field_type == "";
field_type = -1;
END;
+IF prefix.defined;
+ name = prefix _ name;
+END;
# date picker fields should always be short
IF field_type == constants.FIELD_TYPE_DATE
|| field_type == constants.FIELD_TYPE_DATETIME;
diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css
index cb16c8fd7..a1183fab4 100644
--- a/extensions/BugModal/web/bug_modal.css
+++ b/extensions/BugModal/web/bug_modal.css
@@ -255,7 +255,8 @@ input[type="number"] {
display: inline;
}
-#duplicate-container, #duplicate-actions {
+#duplicate-container, #duplicate-actions,
+#bottom-duplicate-container, #bottom-duplicate-actions {
display: table-cell;
vertical-align: top;
padding-left: 8px;
@@ -265,8 +266,8 @@ input[type="number"] {
margin-left: 4px;
}
-#duplicate-container #dup_up {
- padding-left: 5px;
+#resolve-as, #bottom-status {
+ display: inline;
}
#after-comment-commit-button {
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index a4ab7b69b..fc6e12bc8 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -678,38 +678,52 @@ $(function() {
});
// knob
- $('#bug_status')
+ $('#bug_status, #bottom-bug_status')
.change(function(event) {
- if (event.target.value == "RESOLVED" || event.target.value == "VERIFIED") {
- $('#resolution').change().show();
+ var that = $(this);
+ var val = that.val();
+ var other = $(that.attr('id') == 'bug_status' ? '#bottom-bug_status' : '#bug_status');
+ other.val(val);
+ if (val == "RESOLVED" || val == "VERIFIED") {
+ $('#resolution, #bottom-resolution').change().show();
}
else {
- $('#resolution').hide();
- $('#duplicate-container').hide();
- $('#mark-as-dup-btn').show();
+ $('#resolution, #bottom-resolution').hide();
+ $('#duplicate-container, #bottom-duplicate-container').hide();
+ $('#mark-as-dup-btn, #bottom-mark-as-dup-btn').show();
}
})
.change();
- $('#resolution')
+ $('#resolution, #bottom-resolution')
.change(function(event) {
+ var that = $(this);
+ var val = that.val();
+ var other = $(that.attr('id') == 'resolution' ? '#bottom-resolution' : '#resolution');
+ other.val(val);
var bug_status = $('#bug_status').val();
- if ((bug_status == "RESOLVED" || bug_status == "VERIFIED") && event.target.value == "DUPLICATE") {
- $('#duplicate-container').show();
- $('#mark-as-dup-btn').hide();
- $('#dup_id').focus();
+ if ((bug_status == "RESOLVED" || bug_status == "VERIFIED") && val == "DUPLICATE") {
+ $('#duplicate-container, #bottom-duplicate-container').show();
+ $('#mark-as-dup-btn, #bottom-mark-as-dup-btn').hide();
+ $(that.attr('id') == 'resolution' ? '#dup_id' : '#bottom-dup_id').focus();
}
else {
- $('#duplicate-container').hide();
- $('#mark-as-dup-btn').show();
+ $('#duplicate-container, #bottom-duplicate-container').hide();
+ $('#mark-as-dup-btn, #bottom-mark-as-dup-btn').show();
}
})
.change();
- $('#mark-as-dup-btn')
+ $('#mark-as-dup-btn, #bottom-mark-as-dup-btn')
.click(function(event) {
event.preventDefault();
$('#bug_status').val('RESOLVED').change();
$('#resolution').val('DUPLICATE').change();
- $('#dup_id').focus();
+ $($(this).attr('id') == 'mark-as-dup-btn' ? '#dup_id' : '#bottom-dup_id').focus();
+ });
+ $('#dup_id, #bottom-dup_id')
+ .change(function(event) {
+ var that = $(this);
+ var other = $(that.attr('id') == 'dup_id' ? '#bottom-dup_id' : '#dup_id');
+ other.val(that.val());
});
// add see-also button
@@ -825,12 +839,8 @@ $(function() {
$('#bug_status').val('RESOLVED').change();
$('#resolution').val($(event.target).text()).change();
$('#top-save-btn').show();
- if ($(event.target).text() == "DUPLICATE") {
- $.scrollTo($('body'));
- }
- else {
- $.scrollTo($('body'), function() { $('#resolution').focus(); });
- }
+ $('#resolve-as').hide();
+ $('#bottom-status').show();
});
$('.status-btn')
.click(function(event) {
@@ -839,7 +849,8 @@ $(function() {
$('#field-status-edit').show();
$('#bug_status').val($(event.target).data('status')).change();
$('#top-save-btn').show();
- $.scrollTo($('body'), function() { $('#bug_status').focus(); });
+ $('#resolve-as').hide();
+ $('#bottom-status').show();
});
// vote button