From 6a23b8335dd9e0786cf2c6ea90c8574ac0c6f28f Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sun, 21 Jun 2009 19:33:40 +0000 Subject: Bug 463598: Improve the performance of the JavaScript that adjusts field values based on the value of another field Patch by Max Kanat-Alexander r=wicked, a=mkanat --- .../default/admin/fieldvalues/confirm-delete.html.tmpl | 16 +++++++++------- template/en/default/bug/field-events.js.tmpl | 12 ++++++++---- template/en/default/bug/field.html.tmpl | 5 +++-- template/en/default/global/user-error.html.tmpl | 8 +++++--- 4 files changed, 25 insertions(+), 16 deletions(-) (limited to 'template') diff --git a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl index b215edf04..64c24357d 100644 --- a/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl +++ b/template/en/default/admin/fieldvalues/confirm-delete.html.tmpl @@ -126,13 +126,15 @@ [% IF value.controlled_values.size %]
  • This value controls the visibility of the following values in other fields:
    - [% FOREACH controlled = value.controlled_values %] - - [% controlled.field.description FILTER html %] - ([% controlled.field.name FILTER html %]): - [%+ controlled.name FILTER html %]
    + [% FOREACH field_name = value.controlled_values.keys %] + [% FOREACH controlled = value.controlled_values.${field_name} %] + + [% controlled.field.description FILTER html %] + ([% controlled.field.name FILTER html %]): + [%+ controlled.name FILTER html %]
    + [% END %] [% END %]
  • [% END %] diff --git a/template/en/default/bug/field-events.js.tmpl b/template/en/default/bug/field-events.js.tmpl index 7cdf64687..06fba1245 100644 --- a/template/en/default/bug/field-events.js.tmpl +++ b/template/en/default/bug/field-events.js.tmpl @@ -27,10 +27,14 @@ '[% 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 %]', + [% FOREACH controlled_field = legal_value.controlled_values.keys %] + [% SET cont_ids = [] %] + [% FOREACH val = legal_value.controlled_values.$controlled_field %] + [% cont_ids.push(val.id) %] + [% END %] + showValueWhen('[% controlled_field FILTER js %]', + [[% cont_ids.join(',') FILTER js %]], '[% field.name FILTER js %]', - '[% legal_value.name FILTER js %]'); + [% legal_value.id FILTER js %]); [% END %] [% END %] diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl index 1d5a194e2..21a73a805 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -134,6 +134,8 @@ [% SET control_value = legal_value.visibility_value %] [% SET control_field = field.value_field %] + [%- legal_value.name FILTER html %] [% END %] [%# When you pass an empty multi-select in the web interface, diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 7994b187c..69811f210 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -490,9 +490,11 @@ [% IF vals.size %] it controls the visibility of the following field values: [% END %] -- cgit v1.2.3-24-g4f1b