From b4aecfefc218d425c7c2b05d0878d4b062613a18 Mon Sep 17 00:00:00 2001 From: rojanu Date: Wed, 2 Apr 2014 16:35:08 +0800 Subject: Bug 539894: Use to group products into classifications in the product drop-down on show_bug.cgi r=glob, a=justdave --- template/en/default/admin/flag-type/edit.html.tmpl | 13 ++-- template/en/default/admin/flag-type/list.html.tmpl | 16 ++--- template/en/default/bug/edit.html.tmpl | 19 +++-- .../en/default/global/product-select.html.tmpl | 80 ++++++++++++++++++++++ template/en/default/list/edit-multiple.html.tmpl | 8 ++- template/en/default/reports/duplicates.html.tmpl | 12 ++-- template/en/default/reports/old-charts.html.tmpl | 12 ++-- template/en/default/request/queue.html.tmpl | 28 ++------ .../en/default/search/search-specific.html.tmpl | 29 ++------ 9 files changed, 135 insertions(+), 82 deletions(-) create mode 100644 template/en/default/global/product-select.html.tmpl (limited to 'template') diff --git a/template/en/default/admin/flag-type/edit.html.tmpl b/template/en/default/admin/flag-type/edit.html.tmpl index 4ee4a999c..5f45b6b76 100644 --- a/template/en/default/admin/flag-type/edit.html.tmpl +++ b/template/en/default/admin/flag-type/edit.html.tmpl @@ -88,12 +88,13 @@ Product/Component:
-
+ [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + add => "__Any__" + onchange => "selectProduct(this, this.form.component, null, null, '__Any__');" + products => products + %]
- - [% FOREACH prod = products %] - - [% END %] - + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + add => "__Any__" + onchange => "selectProduct(this, this.form.component, null, null, '__Any__');" + products => products + %]
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl index 61fa2c1ec..ae33146a7 100644 --- a/template/en/default/bug/edit.html.tmpl +++ b/template/en/default/bug/edit.html.tmpl @@ -241,11 +241,20 @@ [%# PRODUCT #%] [%#############%] - [% INCLUDE bug/field.html.tmpl - bug = bug, field = bug_fields.product, - override_legal_values = bug.choices.product - desc_url = 'describecomponents.cgi', value = bug.product - editable = bug.check_can_change_field('product', 0, 1) %] + [% PROCESS "bug/field-label.html.tmpl" + field = bug_fields.product + desc_url = 'describecomponents.cgi' + value = bug.product + %] + + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + value => bug.product + products => bug.choices.product + isselect => bug.check_can_change_field('product', 0, 1) + %] + [%# Classification is here so that it can be used in value controllers diff --git a/template/en/default/global/product-select.html.tmpl b/template/en/default/global/product-select.html.tmpl new file mode 100644 index 000000000..8e43c9d0e --- /dev/null +++ b/template/en/default/global/product-select.html.tmpl @@ -0,0 +1,80 @@ +[%# 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. + #%] + +[%# INTERFACE: + # name: mandatory; field name + # id: optional; field id + # value: optional; default field value/selection + # classes: optional; an array of classes to be added + # onchange: optional; onchange attribute value + # disabled: optional; if true, the field is disabled + # accesskey: optional; accesskey attribute value + # add: optional; prepend menu option for value specified to start of select + # dontchange: optional; prepend menu option for "dontchange" to start of select + # multiple: optional; do multiselect box, value is size (height) of box + # title: optional; extra information to display as a tooltip + # products: optional; an array of custom product names + # isselect: optional; whether the product list should be displayed as a + [% IF add %] + + [% END %] + [% IF dontchange %] + + [% END %] + + [% IF Param('useclassification') %] + [% product_ids = {} %] + [% IF products %] + [% FOREACH p = products %] + [% key = p.id -%] + [% product_ids.$key = p.id -%] + [% END %] + [% END %] + [% FOREACH c = user.get_selectable_classifications %] + + [% FOREACH p = user.get_selectable_products(c.id) %] + [% NEXT IF (products && ! product_ids.exists(p.id)) %] + + [% END %] + + [% END %] + [% ELSE %] + [% products = user.get_selectable_products UNLESS products %] + [% FOREACH p = products %] + + [% END %] + [% END %] + +[% ELSE %] + [% value.join(', ') FILTER html %] +[% END %] diff --git a/template/en/default/list/edit-multiple.html.tmpl b/template/en/default/list/edit-multiple.html.tmpl index 2282d69f4..5adc47a59 100644 --- a/template/en/default/list/edit-multiple.html.tmpl +++ b/template/en/default/list/edit-multiple.html.tmpl @@ -49,9 +49,11 @@ - [% PROCESS selectmenu menuname = "product" - menuitems = products - property = "name" %] + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + dontchange => dontchange + %] diff --git a/template/en/default/reports/duplicates.html.tmpl b/template/en/default/reports/duplicates.html.tmpl index 67d1f233e..0d47aae75 100644 --- a/template/en/default/reports/duplicates.html.tmpl +++ b/template/en/default/reports/duplicates.html.tmpl @@ -51,13 +51,11 @@ Restrict to products: - + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + multiple => 5 + %] diff --git a/template/en/default/reports/old-charts.html.tmpl b/template/en/default/reports/old-charts.html.tmpl index b3ebe386d..acebca74d 100644 --- a/template/en/default/reports/old-charts.html.tmpl +++ b/template/en/default/reports/old-charts.html.tmpl @@ -7,7 +7,6 @@ #%] [%# INTERFACE: - # products: an array of product names the user is allowed to view. # datasets: an array of hashes with available statuses and resolutions. # url_image: URL of the generated graph. #%] @@ -29,11 +28,12 @@ Product: - + [% INCLUDE "global/product-select.html.tmpl" + id => "product_id" + name => "product_id" + valueattribute => "id" + add => "-All-" + %] diff --git a/template/en/default/request/queue.html.tmpl b/template/en/default/request/queue.html.tmpl index 07dec7315..b2b76ba0b 100644 --- a/template/en/default/request/queue.html.tmpl +++ b/template/en/default/request/queue.html.tmpl @@ -67,28 +67,12 @@ to some group are shown by default. Product: - + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + add => "Any" + onchange => "selectProduct(this, this.form.component, null, null, 'Any');" + %] Flag: diff --git a/template/en/default/search/search-specific.html.tmpl b/template/en/default/search/search-specific.html.tmpl index 4d1b4c7ef..e5d59abfb 100644 --- a/template/en/default/search/search-specific.html.tmpl +++ b/template/en/default/search/search-specific.html.tmpl @@ -60,30 +60,11 @@ for "crash secure SSL flash". - + [% INCLUDE "global/product-select.html.tmpl" + id => "product" + name => "product" + add => "All" + %] -- cgit v1.2.1