]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1020821 - Product drop down orders classifications alphabetically
authorSimon Green <sgreen@redhat.com>
Wed, 2 Jul 2014 00:57:56 +0000 (10:57 +1000)
committerSimon Green <sgreen@redhat.com>
Wed, 2 Jul 2014 00:57:56 +0000 (10:57 +1000)
r=gkl, a=glob

Bugzilla/Template.pm
template/en/default/global/product-select.html.tmpl

index cf337d9fc373c05edcd29fd09dbcca483d6d2543..d1457a4fa2c5b78789eabb759cc07376031a0a13 100644 (file)
@@ -17,6 +17,7 @@ use Bugzilla::Hook;
 use Bugzilla::Install::Requirements;
 use Bugzilla::Install::Util qw(install_string template_include_path 
                                include_languages);
+use Bugzilla::Classification;
 use Bugzilla::Keyword;
 use Bugzilla::Util;
 use Bugzilla::Error;
@@ -1018,6 +1019,11 @@ sub create {
             'css_files' => \&css_files,
             yui_resolve_deps => \&yui_resolve_deps,
 
+            # All classifications (sorted by sortkey, name)
+            'all_classifications' => sub {
+                return [map { $_->name } Bugzilla::Classification->get_all()];
+            },
+
             # Whether or not keywords are enabled, in this Bugzilla.
             'use_keywords' => sub { return Bugzilla::Keyword->any_exist; },
 
index ba5ce73b4c33256f1f4a8e46aa5f372f0738d099..23a7b3d589ac8ae9bb61c4d91d1bf6099f8cd7ee 100644 (file)
           [% END %]
         [% END %]
       [% END %]
-      [% FOREACH c = classifications.keys.sort %]
-         <optgroup label="[% c FILTER html %]">
+
+      [% FOREACH c = all_classifications %]
+        [% NEXT UNLESS classifications.${c}.size %]
+        <optgroup label="[% c FILTER html %]">
           [% FOREACH p = classifications.$c %]
             <option value="[% p.$valueattribute FILTER html %]"
               [% " selected" IF (cgi.param(name) == p.name) || (value.contains(p.name)) %]>