New advanced search filter size/layout options
authorPasi Kallinen <pasi.kallinen@pttk.fi>
Tue, 3 Sep 2013 15:13:48 +0000 (18:13 +0300)
committerDan Wells <dbw2@calvin.edu>
Mon, 23 Sep 2013 18:56:01 +0000 (14:56 -0400)
Allow setting the heights of the advanced search select boxes in
config.tt2. Also provide colspan and rowspan for adjusting the layout
of the filter boxes.

Signed-off-by: Pasi Kallinen <pasi.kallinen@pttk.fi>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/templates/opac/parts/advanced/search.tt2
Open-ILS/src/templates/opac/parts/coded_value_selector.tt2
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/filter_group_selector.tt2

index 56fd012..0f8b43f 100644 (file)
@@ -44,7 +44,9 @@
         END; %]
             <td valign='top'[% IF adv_chunk.js_only %] 
                 id='adv_chunk_[% adv_chunk.adv_special %]' 
-                class='hidden'[% END %]>
+                class='hidden'[% END %]
+               [% IF adv_chunk.colspan %]colspan='[% adv_chunk.colspan %]'[% END %]
+               [% IF adv_chunk.rowspan %]rowspan='[% adv_chunk.rowspan %]'[% END %]>
                 <strong>[% adv_chunk.adv_label %]</strong><br />
 [%
         IF adv_chunk.adv_special;
             END;
         ELSIF adv_chunk.adv_attr;
             INCLUDE "opac/parts/coded_value_selector.tt2"
-                attr=adv_chunk.adv_attr multiple="multiple" size="4";
+                attr=adv_chunk.adv_attr multiple="multiple" size=adv_chunk.adv_size || search.default_adv_select_height || "4";
         ELSIF adv_chunk.adv_filter;
             INCLUDE "opac/parts/filter_group_selector.tt2"
-                filter_group=adv_chunk.adv_filter multiple="multiple" size="4";
+                filter_group=adv_chunk.adv_filter multiple="multiple" size=adv_chunk.adv_size || search.default_adv_select_height || "4";
         END; %]
             </td>
 [%
index 7d7a03a..7e6beb8 100644 (file)
@@ -13,6 +13,7 @@
     name = name || "fi:" _ attr_class;
     id = id || attr_class _ "_selector";
     values = values || CGI.param(name); 
+    IF size AND size < 1; size = all_values.size; END;
 -%]
 
 <select id='[% id %]' name='[% name %]'[%
index d798fb9..49e0e43 100644 (file)
@@ -97,16 +97,20 @@ facet.default_display_count = 5;
 
 ##############################################################################
 # Define the advanced search limiters and labels.
+# Each entry is put into a table cell.
 # adv_label is the (translated) label for the limiter
 # adv_attr is an array of possible limiters, the first one that has any
 #   values will be used
 # adv_filter is the same as adv_attr, but for search filter groups
+# adv_size lets you set the height of the adv_attr or adv_filter select box.
+# if adv_size < 1, the box height is set to the number of options in it.
 # adv_break will end the current row. If specified with a label/attr it
 #   will do so *after* that limiter.
 # adv_special will drop in a special entry:
 #   lib_selector will put the search library box (with limit to available)
 #   pub_year will put the publication year box
 #   sort_selector will put the sort results selector
+# if present, colspan and rowspan will be used for the table cell.
 
 search.adv_config = [
     {adv_label => l("Item Type"), adv_attr => ["mattype", "item_type"]},
@@ -122,6 +126,9 @@ search.adv_config = [
     {adv_label => l("Sort Results"), adv_special => "sort_selector"},
 ];
 
+# Set the default height of the select boxes. Defaults to 4.
+#search.default_adv_select_height = 4;
+
 ##############################################################################
 # For each search box the default "query type" value can be specified here
 # This is the actual backend value, not the label
index bede19e..239516d 100644 (file)
@@ -11,6 +11,7 @@
     id = id || group.code _ "_selector";
     class = class || '';
     values = values || CGI.param(name); 
+    IF size AND size < 1; size = group.entries.size; END;
 -%]
 
 <select id='[% id %]' class='[% class %]' name='[% name %]'[%