From 38cbb6ac784948b93728cc25259187580e5bb813 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 28 Feb 2012 23:26:33 +0100 Subject: Bug 695514: Slow performance in field-events.js.tmpl on show_bug.cgi with large number of products r=dkl a=LpSolit --- template/en/default/bug/create/create.html.tmpl | 2 +- template/en/default/bug/field-events.js.tmpl | 12 +++++++++++- template/en/default/bug/field.html.tmpl | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) (limited to 'template') diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 58fb0c937..3b46ba40f 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -231,7 +231,7 @@ TUI_hide_default('attachment_text_field'); diff --git a/template/en/default/bug/field-events.js.tmpl b/template/en/default/bug/field-events.js.tmpl index fa805b528..003391c34 100644 --- a/template/en/default/bug/field-events.js.tmpl +++ b/template/en/default/bug/field-events.js.tmpl @@ -8,6 +8,8 @@ [%# INTERFACE: # field: a Bugzilla::Field object + # product: (optional) a Bugzilla::Product object. When specified, + # components are restricted to this product. #%] [% FOREACH controlled_field = field.controls_visibility_of %] @@ -18,7 +20,15 @@ [%- END %] ]); [% END %] -[% FOREACH legal_value = field.legal_values %] + +[% legal_values = [] %] +[% IF field.name == "component" AND product %] + [% legal_values = product.components %] +[% ELSE %] + [% legal_values = field.legal_values %] +[% END %] + +[% FOREACH legal_value = legal_values %] [% FOREACH controlled_field = legal_value.controlled_values.keys %] [% SET cont_ids = [] %] [% FOREACH val = legal_value.controlled_values.$controlled_field %] diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl index 12f1bb7f9..78e919a2d 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -133,7 +133,8 @@ -- cgit v1.2.3-24-g4f1b