implement counter near results table
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 23 May 2018 15:12:09 +0000 (11:12 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 23 May 2018 15:12:09 +0000 (11:12 -0400)
Note that this counter shows the number of records in the temporary list/cart,
not just the number of records selected on the page.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/opac/css/style.css.tt2
Open-ILS/src/templates/opac/parts/result/table.tt2
Open-ILS/web/js/ui/default/opac/record_selectors.js

index bc5248f..489b408 100644 (file)
@@ -1030,9 +1030,13 @@ tr.result_table_row > td.result_table_pic_header {
     width: 78px;
 }
 
+/* styles for selecting records in the results set */
 .result_table_row_selected {
     background-color: [% css_colors.item_selected %];
 }
+#selected_records_summary {
+    margin-left: 5em;
+}
 
 .result_number {
     [% IF rtl == 't' -%]
index 9c2d9e9..77e47dd 100644 (file)
                 <div id="record_selector_block" class="hidden">
                     <input type="checkbox" id="select_all_records"></input>
                     <label for="select_all_records">[% l('Select [_1] - [_2]', ctx.result_start, ctx.result_stop) %]</label>
+                    <span id="selected_records_summary">
+                        <span id="selected_records_count">[% ctx.mylist.size %]</span>
+                        [% IF ctx.mylist.size == 1; %]
+                            [% l('selected title') %]
+                        [% ELSE; %]
+                            [% l('selected titles') %]
+                        [% END; %]
+                    <span>
                 </div>
                 [% END %]
                 <table id="result_table_table" title="[% l('Search Results') %]"
index 5f58dbf..89cd972 100644 (file)
@@ -20,6 +20,7 @@
                 var result = req.response;
                 if (result) {
                     mylist = result.mylist;
+                    document.getElementById('selected_records_count').innerHTML = mylist.length;
                 }
             }
         } else {
@@ -28,6 +29,7 @@
                 var result = JSON.parse(req.responseText);
                 if (result) {
                     mylist = result.mylist;
+                    document.getElementById('selected_records_count').innerHTML = mylist.length;
                 }
             }
         }