From d9a166a767592ea2f2647f9fca3e43d21f0cd4aa Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 28 Feb 2012 23:28:17 +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/en') diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl index 3fdf56472..f3dd680df 100644 --- a/template/en/default/bug/create/create.html.tmpl +++ b/template/en/default/bug/create/create.html.tmpl @@ -251,7 +251,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 94dd298f5..13ec18d38 100644 --- a/template/en/default/bug/field-events.js.tmpl +++ b/template/en/default/bug/field-events.js.tmpl @@ -19,6 +19,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 %] @@ -29,7 +31,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 9c956ea91..681ea716d 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -149,7 +149,8 @@ -- cgit v1.2.3-24-g4f1b