summaryrefslogtreecommitdiffstats
path: root/extensions/FlagDefaultRequestee/template
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-08-30 00:42:36 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-08-30 00:42:36 +0200
commitf44b326ed86cb8d1adf76c78e73b7f2af60ca2a5 (patch)
treef14907f08bca422dfa0ed9707e7ed5e9bf323007 /extensions/FlagDefaultRequestee/template
parentcca07e40f68720087992ec8b5337bca91a942d91 (diff)
downloadbugzilla-f44b326ed86cb8d1adf76c78e73b7f2af60ca2a5.tar.gz
bugzilla-f44b326ed86cb8d1adf76c78e73b7f2af60ca2a5.tar.xz
Bug 726353 - Add default value to ui-review requests
r=glob
Diffstat (limited to 'extensions/FlagDefaultRequestee/template')
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/flag/default_requestees.html.tmpl101
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl21
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/hook/attachment/create-end.html.tmpl9
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/hook/attachment/edit-end.html.tmpl9
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/hook/bug/create/create-form.html.tmpl9
-rw-r--r--extensions/FlagDefaultRequestee/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl9
6 files changed, 158 insertions, 0 deletions
diff --git a/extensions/FlagDefaultRequestee/template/en/default/flag/default_requestees.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/flag/default_requestees.html.tmpl
new file mode 100644
index 000000000..9bd656775
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/flag/default_requestees.html.tmpl
@@ -0,0 +1,101 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% IF flag_default_requestees.keys.size %]
+ <script type="text/javascript">
+ var currently_requested = new Array();
+ var default_requestees = new Array();
+ [% FOREACH id = flag_currently_requested.keys %]
+ currently_requested.push('[% id FILTER js %]');
+ [% END %]
+ [% FOREACH id = flag_default_requestees.keys %]
+ default_requestees['id_[% id FILTER js %]'] = '[% flag_default_requestees.$id FILTER js %]';
+ [% END %]
+
+ function fdrSetDefaultRequestee(field, default_requestee) {
+ field.value = default_requestee;
+ field.focus();
+ field.select();
+ }
+
+ function fdrOnChange(ev) {
+ var parts = ev.target.id.split('-');
+ var flag = parts[0];
+ var id = parts[1];
+ var state = ev.target.value;
+ var requestee_field;
+
+ if (flag.search(/_type/) == -1) {
+ for (var i = 0; i < currently_requested.length; i++) {
+ if (id == currently_requested[i]) {
+ return;
+ }
+ }
+ requestee_field = YAHOO.util.Dom.get('requestee-' + id);
+ parts = ev.target.className.split('-');
+ id = parts[1];
+ }
+ else {
+ requestee_field = YAHOO.util.Dom.get('requestee_type-' + id);
+ }
+
+ var current_requestee = requestee_field.value;
+ var default_requestee = default_requestees['id_' + id];
+
+ if (state == '?' && !current_requestee && default_requestee) {
+ fdrSetDefaultRequestee(requestee_field, default_requestees['id_' + id]);
+ }
+ else if (state == '?' && current_requestee != default_requestee) {
+ fdrShowDefaultLink(requestee_field, id);
+ }
+ }
+
+ YAHOO.util.Event.onDOMReady(function() {
+ var selects = YAHOO.util.Dom.getElementsByClassName('flag_select');
+ for (var i = 0; i < selects.length; i++) {
+ YAHOO.util.Event.on(selects[i], 'change', fdrOnChange);
+ }
+
+ for (var i = 0; i < currently_requested.length; i++) {
+ var flag_id = currently_requested[i];
+ var flag_field = YAHOO.util.Dom.get('flag-' + flag_id);
+ var requestee_field = YAHOO.util.Dom.get('requestee-' + flag_id);
+ var parts = flag_field.className.split('-');
+ var type_id = parts[1];
+ var current_requestee = requestee_field.value;
+ var default_requestee = default_requestees['id_' + type_id];
+ if (current_requestee != default_requestee) {
+ fdrShowDefaultLink(requestee_field, type_id, flag_id);
+ }
+ }
+ });
+
+ function fdrHideDefaultLink (flag_id) {
+ YAHOO.util.Dom.addClass('default_requestee_' + flag_id, 'bz_default_hidden');
+ }
+
+ function fdrShowDefaultLink (requestee_field, type_id, flag_id) {
+ var default_requestee = default_requestees['id_' + type_id];
+
+ var default_link = document.createElement('a');
+ YAHOO.util.Dom.setAttribute(default_link, 'href', 'javascript:void(0)');
+ default_link.appendChild(document.createTextNode('default requestee'));
+ YAHOO.util.Event.addListener(default_link, 'click', function() {
+ fdrSetDefaultRequestee(requestee_field, default_requestee);
+ fdrHideDefaultLink(flag_id);
+ });
+
+ var default_span = document.createElement('span');
+ YAHOO.util.Dom.setAttribute(default_span, 'id', 'default_requestee_' + flag_id);
+ default_span.appendChild(document.createTextNode('('));
+ default_span.appendChild(default_link);
+ default_span.appendChild(document.createTextNode(')'));
+ requestee_field.parentNode.appendChild(default_span);
+ }
+ </script>
+[% END %]
diff --git a/extensions/FlagDefaultRequestee/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl
new file mode 100644
index 000000000..edefca370
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl
@@ -0,0 +1,21 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+<tr>
+ <th>Default Requestee:</th>
+ <td>
+ If flag is specifically requestable, this user will be entered in the
+ requestee field by default unless the user changes it.<br>
+ [% INCLUDE global/userselect.html.tmpl
+ name => 'default_requestee'
+ id => 'default_requestee'
+ value => type.default_requestee.login
+ classes => ['requestee']
+ %]
+ </td>
+</tr>
diff --git a/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/create-end.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/create-end.html.tmpl
new file mode 100644
index 000000000..20b2526d0
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/create-end.html.tmpl
@@ -0,0 +1,9 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% INCLUDE flag/default_requestees.html.tmpl %]
diff --git a/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/edit-end.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/edit-end.html.tmpl
new file mode 100644
index 000000000..20b2526d0
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/hook/attachment/edit-end.html.tmpl
@@ -0,0 +1,9 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% INCLUDE flag/default_requestees.html.tmpl %]
diff --git a/extensions/FlagDefaultRequestee/template/en/default/hook/bug/create/create-form.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/hook/bug/create/create-form.html.tmpl
new file mode 100644
index 000000000..20b2526d0
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/hook/bug/create/create-form.html.tmpl
@@ -0,0 +1,9 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% INCLUDE flag/default_requestees.html.tmpl %]
diff --git a/extensions/FlagDefaultRequestee/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl b/extensions/FlagDefaultRequestee/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl
new file mode 100644
index 000000000..20b2526d0
--- /dev/null
+++ b/extensions/FlagDefaultRequestee/template/en/default/hook/bug/edit-after_custom_fields.html.tmpl
@@ -0,0 +1,9 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% INCLUDE flag/default_requestees.html.tmpl %]