Bug 12137: followup sort <select> index by value
authorIndranil Das Gupta <indradg@gmail.com>
Sat, 20 Jun 2015 12:52:32 +0000 (18:22 +0530)
committerTomas Cohen Arazi <tomascohen@unc.edu.ar>
Mon, 20 Jul 2015 13:44:05 +0000 (10:44 -0300)
adds alphabetical sorting to <select> lists displayed by
preferences.tt. although added for sorting the days of the
week, this may have larger ramifications. haven't been
tested thoroughly, but no apparent breakage seems to be
happening in preferences.

NOTE: Nice tweak. Makes days of week in sensible order.
      Properly adds sorting based on documentation that
      is really hard to find.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt

index 913a80e..4466b58 100644 (file)
                     <input type="[%IF CHUNK.input_type %][% CHUNK.input_type %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "short" %]" value="[% CHUNK.value %]" autocomplete="off" /> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
                     [% ELSIF ( CHUNK.type_select ) %]
                     <select name="pref_[% CHUNK.name %]" id="pref_[% CHUNK.name %]" class="preference preference-[% CHUNK.class or "choice" %]">
-                        [% FOREACH CHOICE IN CHUNK.CHOICES %]
+                        [% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
                         [% IF ( CHOICE.selected ) %]
                         <option value="[% CHOICE.value %]" selected="selected">
                         [% ELSE %]