summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-02-28 23:26:33 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-02-28 23:26:33 +0100
commit38cbb6ac784948b93728cc25259187580e5bb813 (patch)
treec2a9528e123f0160cb9f6e5e93539d96201ccc07 /template
parentf0e69404788bc0ac89b21423bb22f464bc78fe0a (diff)
downloadbugzilla-38cbb6ac784948b93728cc25259187580e5bb813.tar.gz
bugzilla-38cbb6ac784948b93728cc25259187580e5bb813.tar.xz
Bug 695514: Slow performance in field-events.js.tmpl on show_bug.cgi with large number of products
r=dkl a=LpSolit
Diffstat (limited to 'template')
-rw-r--r--template/en/default/bug/create/create.html.tmpl2
-rw-r--r--template/en/default/bug/field-events.js.tmpl12
-rw-r--r--template/en/default/bug/field.html.tmpl3
3 files changed, 14 insertions, 3 deletions
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');
<script type="text/javascript">
<!--
[%+ INCLUDE "bug/field-events.js.tmpl"
- field = bug_fields.component %]
+ field = bug_fields.component, product = product %]
//-->
</script>
</td>
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 @@
<script type="text/javascript">
<!--
initHidingOptionsForIE('[% field.name FILTER js %]');
- [%+ INCLUDE "bug/field-events.js.tmpl" field = field %]
+ [%+ INCLUDE "bug/field-events.js.tmpl"
+ field = field, product = bug.product_obj %]
//-->
</script>