summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl7
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/field.html.tmpl16
-rw-r--r--extensions/BugModal/web/bug_modal.css9
-rw-r--r--extensions/BugModal/web/bug_modal.js9
4 files changed, 36 insertions, 5 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 fa87066fd..095724e67 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -455,7 +455,7 @@
[% IF unassigned %]
<i>Unassigned</i>
[% IF bug.check_can_change_field("assigned_to", 0, 1) %]
- <button type="button" id="take-btn" class="minor">Take</button>
+ <button type="button" class="take-btn minor" data-field="assigned_to">Take</button>
[% END %]
[% ELSE %]
[% INCLUDE bug_modal/user.html.tmpl u=bug.assigned_to %]
@@ -465,6 +465,11 @@
field = bug_fields.assigned_to
field_type = constants.FIELD_TYPE_USER
hide_on_view = 1
+ action = {
+ class = "take-btn"
+ caption = "Take"
+ hidden = bug.assigned_to.id == user.id || !user.in_group("editbugs")
+ }
append_content = 1
default = bug.component_obj.default_assignee.login
%]
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 b11152bf1..c988bd645 100644
--- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
@@ -25,6 +25,11 @@
# 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);
# default: (string) default value (eg. used as a placeholder in user fields)
+ # action: (hash) show a button to the right of the edit field (user fields only currently). keys:
+ # id: (string) optional button id
+ # class: (string) optional button class
+ # caption: (string) button caption
+ # hidden: (boolean) don't show the button (default: false)
#%]
[%
@@ -191,6 +196,14 @@ END;
<input name="[% name FILTER html %]" id="[% name FILTER html %]" value="[% value FILTER html %]">
[% CASE constants.FIELD_TYPE_USER %]
+ [% IF action && !action.hidden %]
+ <button class="field-button minor [%= action.class FILTER html IF action.class %]"
+ data-field="[% name FILTER html %]"
+ [% IF action.id %]id="[% action.id FILTER html %]"[% END %]>
+ [% action.caption FILTER html %]
+ </button>
+ <div class="field-edit-container">
+ [% END %]
[%# single user %]
[% INCLUDE global/userselect.html.tmpl
id = name
@@ -199,6 +212,9 @@ END;
classes = [ "bz_userfield" ]
placeholder = default
%]
+ [% IF action && !action.hidden %]
+ </div>
+ [% END %]
[% CASE constants.FIELD_TYPE_USERS %]
[%# multiple users %]
diff --git a/extensions/BugModal/web/bug_modal.css b/extensions/BugModal/web/bug_modal.css
index e69bcaa2a..afa4719c4 100644
--- a/extensions/BugModal/web/bug_modal.css
+++ b/extensions/BugModal/web/bug_modal.css
@@ -206,6 +206,15 @@ select[multiple], .text_input, .yui-ac-input, input {
width: 170px;
}
+.field-button {
+ float: right;
+ margin-left: 8px;
+}
+
+.field-edit-container {
+ overflow-y: hidden;
+}
+
/* field types */
input[type="number"] {
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index 4c4d83ad8..a9ff51452 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -544,12 +544,13 @@ $(function() {
});
// take button
- $('#take-btn')
+ $('.take-btn')
.click(function(event) {
event.preventDefault();
- $('#field-assigned_to.edit-hide').hide();
- $('#field-assigned_to.edit-show').show();
- $('#assigned_to').val(BUGZILLA.user.login).focus().select();
+ var field = $(this).data('field');
+ $('#field-' + field + '.edit-hide').hide();
+ $('#field-' + field + '.edit-show').show();
+ $('#' + field).val(BUGZILLA.user.login).focus().select();
$('#top-save-btn').show();
});