summaryrefslogtreecommitdiffstats
path: root/extensions/ComponentWatching
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-04-09 16:49:29 +0200
committerByron Jones <bjones@mozilla.com>2012-04-09 16:49:29 +0200
commit038e32c1753b1d7bfbf026ee99f6128e038cc70c (patch)
treef3c5f8dcd55ae2af988605b9581b11561de9310c /extensions/ComponentWatching
parent304df9d6e97140b7a717176302be5d407266b03d (diff)
downloadbugzilla-038e32c1753b1d7bfbf026ee99f6128e038cc70c.tar.gz
bugzilla-038e32c1753b1d7bfbf026ee99f6128e038cc70c.tar.xz
Bug 738329: allow preseleting products and components in component-watch prefs
Diffstat (limited to 'extensions/ComponentWatching')
-rw-r--r--extensions/ComponentWatching/Extension.pm7
-rw-r--r--extensions/ComponentWatching/template/en/default/account/prefs/component_watch.html.tmpl15
2 files changed, 17 insertions, 5 deletions
diff --git a/extensions/ComponentWatching/Extension.pm b/extensions/ComponentWatching/Extension.pm
index c47fa4749..db191dfbe 100644
--- a/extensions/ComponentWatching/Extension.pm
+++ b/extensions/ComponentWatching/Extension.pm
@@ -178,6 +178,7 @@ sub user_preferences {
my $save = $args->{'save_changes'};
my $handled = $args->{'handled'};
+ my $vars = $args->{'vars'};
my $user = Bugzilla->user;
my $input = Bugzilla->input_params;
@@ -189,7 +190,7 @@ sub user_preferences {
my $productName = $input->{'add_product'};
my $ra_componentNames = $input->{'add_component'};
- $ra_componentNames = [$ra_componentNames] unless ref($ra_componentNames);
+ $ra_componentNames = [$ra_componentNames || ''] unless ref($ra_componentNames);
# load product and verify access
my $product = Bugzilla::Product->new({ name => $productName });
@@ -227,7 +228,9 @@ sub user_preferences {
}
}
- $args->{'vars'}->{'watches'} = _getWatches($user);
+ $vars->{'add_product'} = $input->{'product'};
+ $vars->{'add_component'} = $input->{'component'};
+ $vars->{'watches'} = _getWatches($user);
$$handled = 1;
}
diff --git a/extensions/ComponentWatching/template/en/default/account/prefs/component_watch.html.tmpl b/extensions/ComponentWatching/template/en/default/account/prefs/component_watch.html.tmpl
index 46acd386f..0eed6b3b3 100644
--- a/extensions/ComponentWatching/template/en/default/account/prefs/component_watch.html.tmpl
+++ b/extensions/ComponentWatching/template/en/default/account/prefs/component_watch.html.tmpl
@@ -46,6 +46,13 @@ function onSelectProduct() {
// support IE
component.add(new Option('__Any__', ''), 0);
}
+ if ('[% add_component FILTER js %]' != ''
+ && bz_valueSelected(Dom.get('product'), '[% add_product FILTER js %]')
+ ) {
+ var index = bz_optionIndex(Dom.get('component'), '[% add_component FILTER js %]');
+ if (index != -1)
+ Dom.get('component').options[index].selected = true;
+ }
onSelectComponent();
}
@@ -75,7 +82,8 @@ watch "__Any__".
<td colspan="2">
<select name="add_product" id="product" onChange="onSelectProduct()">
[% FOREACH product IN selectable_products %]
- <option>[% product.name FILTER html %]</option>
+ <option [% 'selected' IF add_product == product.name %]>
+ [%~ product.name FILTER html %]</option>
[% END %]
</select>
</td>
@@ -83,11 +91,12 @@ watch "__Any__".
<tr>
<td align="right" valign="top">Component:</td>
<td>
- <select name="add_component" id="component" multiple size="5" onChange="onSelectComponent()">
+ <select name="add_component" id="component" multiple size="10" onChange="onSelectComponent()">
<option value="">__Any__</option>
[% FOREACH product IN selectable_products %]
[% FOREACH component IN product.components %]
- <option>[% component.name FILTER html %]</option>
+ <option [% 'selected' IF add_component == component.name %]>
+ [%~ component.name FILTER html %]</option>
[% END %]
[% END %]
</select>