summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug
diff options
context:
space:
mode:
Diffstat (limited to 'template/en/default/bug')
-rw-r--r--template/en/default/bug/create/create.html.tmpl11
-rw-r--r--template/en/default/bug/field-events.js.tmpl36
-rw-r--r--template/en/default/bug/field.html.tmpl32
-rw-r--r--template/en/default/bug/knob.html.tmpl12
4 files changed, 64 insertions, 27 deletions
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl
index 0b941cc35..089292603 100644
--- a/template/en/default/bug/create/create.html.tmpl
+++ b/template/en/default/bug/create/create.html.tmpl
@@ -642,13 +642,12 @@ function handleWantsAttachment(wants_attachment) {
</select>
[% IF sel.name == "bug_status" %]
- [% FOREACH controlled = select_fields.bug_status.controls_visibility_of %]
- <script type="text/javascript">
- showFieldWhen('[% controlled.name FILTER js %]',
- 'bug_status',
- '[% controlled.visibility_value.name FILTER js %]');
+ <script type="text/javascript">
+ <!--
+ [%+ INCLUDE "bug/field-events.js.tmpl"
+ field = select_fields.bug_status %]
+ //-->
</script>
- [% END %]
[% END %]
</td>
[% END %]
diff --git a/template/en/default/bug/field-events.js.tmpl b/template/en/default/bug/field-events.js.tmpl
new file mode 100644
index 000000000..7cdf64687
--- /dev/null
+++ b/template/en/default/bug/field-events.js.tmpl
@@ -0,0 +1,36 @@
+[%# The contents of this file are subject to the Mozilla Public
+ # License Version 1.1 (the "License"); you may not use this file
+ # except in compliance with the License. You may obtain a copy of
+ # the License at http://www.mozilla.org/MPL/
+ #
+ # Software distributed under the License is distributed on an "AS
+ # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ # implied. See the License for the specific language governing
+ # rights and limitations under the License.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is the San Jose State
+ # University Foundation. Portions created by the Initial Developer
+ # are Copyright (C) 2008 the Initial Developer. All Rights Reserved.
+ #
+ # Contributor(s): Max Kanat-Alexander <mkanat@bugzilla.org>
+ #%]
+
+[%# INTERFACE:
+ # field: a Bugzilla::Field object
+ #%]
+
+[% FOREACH controlled_field = field.controls_visibility_of %]
+ showFieldWhen('[% controlled_field.name FILTER js %]',
+ '[% field.name FILTER js %]',
+ '[% controlled_field.visibility_value.name FILTER js %]');
+[% END %]
+[% FOREACH legal_value = field.legal_values %]
+ [% FOREACH controlled_value = legal_value.controlled_values %]
+ showValueWhen('[% controlled_value.field.name FILTER js %]',
+ '[% controlled_value.name FILTER js %]',
+ '[% field.name FILTER js %]',
+ '[% legal_value.name FILTER js %]');
+ [% END %]
+[% END %]
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index 9b93a9ff2..d29aaa305 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -126,10 +126,20 @@
</option>
[% END %]
[% FOREACH legal_value = field.legal_values %]
+ [% SET control_value = legal_value.visibility_value %]
+ [% SET control_field = field.value_field %]
<option value="[% legal_value.name FILTER html %]"
- [%- " selected=\"selected\""
- IF value.contains(legal_value.name).size %]>
- [%- legal_value.name FILTER html %]</option>
+ [%# We always show selected values, even if they should be
+ # hidden %]
+ [% IF value.contains(legal_value.name).size %]
+ selected="selected"
+ [% ELSIF control_field && control_value
+ && !bug.${control_field.name}.contains(control_value.name)
+ %]
+ class="bz_hidden_option" disabled="disabled"
+ [% END %]>
+ [%- legal_value.name FILTER html -%]
+ </option>
[% END %]
</select>
[%# When you pass an empty multi-select in the web interface,
@@ -142,19 +152,19 @@
[% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
<input type="hidden" name="defined_[% field.name FILTER html %]">
[% END %]
+
+ <script type="text/javascript">
+ <!--
+ initHidingOptionsForIE('[% field.name FILTER js %]');
+ [%+ INCLUDE "bug/field-events.js.tmpl" field = field %]
+ //-->
+ </script>
+
[% CASE constants.FIELD_TYPE_TEXTAREA %]
[% INCLUDE global/textarea.html.tmpl
id = field.name name = field.name minrows = 4 maxrows = 8
cols = 60 defaultcontent = value %]
[% END %]
-
- [% FOREACH controlled_field = field.controls_visibility_of %]
- <script type="text/javascript">
- showFieldWhen('[% controlled_field.name FILTER js %]',
- '[% field.name FILTER js %]',
- '[% controlled_field.visibility_value.name FILTER js %]');
- </script>
- [% END %]
[% ELSIF field.type == constants.FIELD_TYPE_TEXTAREA %]
<div class="uneditable_textarea">[% value FILTER wrap_comment(60)
FILTER html %]</div>
diff --git a/template/en/default/bug/knob.html.tmpl b/template/en/default/bug/knob.html.tmpl
index 038e6cbb3..be94559aa 100644
--- a/template/en/default/bug/knob.html.tmpl
+++ b/template/en/default/bug/knob.html.tmpl
@@ -122,16 +122,8 @@
['[% "is_duplicate" IF bug.dup_id %]',
'[% bug.bug_status FILTER js %]'] );
- [% FOREACH controlled = select_fields.bug_status.controls_visibility_of %]
- showFieldWhen('[% controlled.name FILTER js %]',
- 'bug_status',
- '[% controlled.visibility_value.name FILTER js %]');
- [% END %]
- [% FOREACH controlled = select_fields.resolution.controls_visibility_of %]
- showFieldWhen('[% controlled.name FILTER js %]',
- 'resolution',
- '[% controlled.visibility_value.name FILTER js %]');
- [% END %]
+ [% INCLUDE "bug/field-events.js.tmpl" field = select_fields.bug_status %]
+ [% INCLUDE "bug/field-events.js.tmpl" field = select_fields.resolution %]
</script>
[%# Common actions %]