aboutsummaryrefslogtreecommitdiff
path: root/template/en/default/global/select-menu.html.tmpl
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2014-06-02 17:14:02 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2014-06-02 17:14:02 +0300
commit46f29f243b1e7642e860b40214d5f893aad678e1 (patch)
tree7ac82cee0957299e51c36f22ce1b172670513348 /template/en/default/global/select-menu.html.tmpl
Initial commit - Bugzilla 4.4.4
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Diffstat (limited to 'template/en/default/global/select-menu.html.tmpl')
-rw-r--r--template/en/default/global/select-menu.html.tmpl52
1 files changed, 52 insertions, 0 deletions
diff --git a/template/en/default/global/select-menu.html.tmpl b/template/en/default/global/select-menu.html.tmpl
new file mode 100644
index 0000000..e9f56b7
--- /dev/null
+++ b/template/en/default/global/select-menu.html.tmpl
@@ -0,0 +1,52 @@
+[%# 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: string; the name of the menu.
+ #
+ # multiple: boolean; whether or not the menu is multi-select
+ #
+ # size: integer; the number of items to display at once
+ #
+ # options: array or hash; the items with which to populate the array.
+ # If a hash is passed, the hash keys become the names displayed
+ # to the user while the hash values become the value of the item.
+ #
+ # default: string; the item selected in the menu by default.
+ #
+ # onchange: code; JavaScript to be run when the user changes the value
+ # selected in the menu.
+ #%]
+
+[%# Get the scalar representation of the options reference,
+ # which looks like "ARRAY(0xA352BA3F)" or "HASH(0xA352BA3F)",
+ # so we can figure out whether it is a reference to an array
+ # or a hash.
+ #%]
+[% options_type = BLOCK %][% options %][% END %]
+
+<select name="[% name FILTER html %]"
+ [% IF onchange %]onchange="[% onchange FILTER html %]"[% END %]
+ [% IF multiple %] multiple [% END %]
+ [% IF size %] size="[% size %]" [% END %]>
+ [% IF options_type.search("ARRAY") %]
+ [% FOREACH value = options %]
+ <option value="[% value FILTER html %]"
+ [% " selected" IF value == default %]>
+ [% value FILTER html %]
+ </option>
+ [% END %]
+ [% ELSIF options_type.search("HASH") %]
+ [% FOREACH option = options %]
+ <option value="[% option.value FILTER html %]"
+ [% " selected" IF option.value == default %]>
+ [% option.key FILTER html %]
+ </option>
+ [% END %]
+ [% END %]
+</select>