summaryrefslogtreecommitdiffstats
path: root/template/en/default/bug
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-10-25 06:11:30 +0200
committermkanat%bugzilla.org <>2008-10-25 06:11:30 +0200
commit3cea91884b28b52df4e38f2ba88c00b65071a81f (patch)
treec0f451235176b2b542a38b0c935dcddf0453a1ee /template/en/default/bug
parente0da20baba17b7f068946c8647fb6d67e77c39b7 (diff)
downloadbugzilla-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.gz
bugzilla-3cea91884b28b52df4e38f2ba88c00b65071a81f.tar.xz
Bug 291433: Ability to have custom fields whose visibility depends on the values of other fields
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bbaetz, a=mkanat
Diffstat (limited to 'template/en/default/bug')
-rw-r--r--template/en/default/bug/field.html.tmpl26
1 files changed, 24 insertions, 2 deletions
diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl
index 762e659db..3b26073aa 100644
--- a/template/en/default/bug/field.html.tmpl
+++ b/template/en/default/bug/field.html.tmpl
@@ -28,9 +28,21 @@
# allow_dont_change: display the --do_not_change-- option for select fields.
# value_span: A colspan for the table cell containing
# the field value.
+ # bug (optional): The current Bugzilla::Bug being displayed, or a hash
+ # with default field values being displayed on a page.
#%]
-<th class="field_label">
+[% SET hidden = 0 %]
+[% IF field.visibility_field.defined %]
+ [% IF !bug.${field.visibility_field.name}
+ .contains(field.visibility_value.name)
+ %]
+ [% SET hidden = 1 %]
+ [% END %]
+[% END %]
+
+<th class="field_label [% ' bz_hidden_field' IF hidden %]"
+ id="field_label_[% field.name FILTER html %]">
[% IF editable %]
<label for="[% field.name FILTER html %]">
[% END %]
@@ -38,7 +50,9 @@
[% '</label>' IF editable %]
</th>
-<td class="field_value" [% "colspan=\"$value_span\"" FILTER none IF value_span %]>
+<td class="field_value [% ' bz_hidden_field' IF hidden %]"
+ id="field_container_[% field.name FILTER html %]"
+ [% " colspan=\"$value_span\"" FILTER none IF value_span %]>
[% IF editable %]
[% SWITCH field.type %]
[% CASE constants.FIELD_TYPE_FREETEXT %]
@@ -121,6 +135,14 @@
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>