LP1916085 Bootstrap OPAC - Pagination on copy table
authorTerran McCanna <tmccanna@georgialibraries.org>
Fri, 19 Feb 2021 00:37:35 +0000 (19:37 -0500)
committerJason Etheridge <jason@EquinoxInitiative.org>
Tue, 23 Feb 2021 23:08:58 +0000 (18:08 -0500)
This adjusts some of the display logic in the Bootstrap OPAC
copy table pagination that had been causing the Next / Prev and
Show Fewer Copies links to be hidden when they shouldn't be.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jason Etheridge <jason@EquinoxInitiative.org>

Open-ILS/src/templates-bootstrap/opac/parts/record/copy_table.tt2

index 130d8aa..034760c 100755 (executable)
@@ -288,12 +288,9 @@ END; # FOREACH bib
 
 [%- END; # FOR copy_info
 %]
-        [%- IF ctx.copy_offset > 0 AND NOT serial_holdings;
-            new_offset = ctx.copy_offset - ctx.copy_limit;
-            IF new_offset < 0; new_offset = 0; END %]
-        [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings AND (ctx.copy_offset + ctx.copy_limit < total_copies) %]
+        [% IF ctx.copy_limit < total_copies AND NOT serial_holdings %]
             <tr class="offset">
-            [%- IF ctx.copy_offset > 0 AND NOT serial_holdings;
+            [%- IF ctx.copy_offset > 0;
                 new_offset = ctx.copy_offset - ctx.copy_limit;
                 IF new_offset < 0; new_offset = 0; END %]
                 <td>
@@ -301,31 +298,35 @@ END; # FOREACH bib
                     l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
                 </td>
             [%- END %]
-            [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings AND (ctx.copy_offset + ctx.copy_limit < total_copies) %]
+            [%- IF copies.size >= ctx.copy_limit AND (ctx.copy_offset + ctx.copy_limit < total_copies) %]
                 <td>
                     <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
                     l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
                 </td>
             [%- END %]
             </tr>
-        [%- END %]
-        [%- END %]
-        [% IF NOT serial_holdings && ctx.copy_limit < total_copies -%]
-            <tr class="not_serial">
-                <td>
-                    [%- more_copies_limit = 50 %] [%# TODO: config %]
-                    [%- IF  ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND ctx.copy_limit < total_copies %]
+        [% END %]
+
+        [% IF NOT serial_holdings -%]
+            [%- more_copies_limit = 50 %] [%# TODO: config %]
+            [%- IF  ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit AND ctx.copy_limit < total_copies %]
+                <tr class="not_serial">
+                    <td>
                         <div class="rdetail_show_copies">
                             <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]"><i class="fas fa-plus-square"></i> [% l('Show more copies') %]</a>
                         </div>
-                    [%- ELSIF ctx.copy_limit == more_copies_limit %]
+                    </td>
+                </tr>
+            [%- ELSIF ctx.copy_limit == more_copies_limit %]
+                <tr class="not_serial">
+                    <td>
                         <div  class="rdetail_show_copies">
                             <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]"><i class="fas fa-minus-square"></i> [% l('Show fewer copies') %]</a>
                         </div>
-                    [%- END %]
-                </td>
-            </tr>
+                    </td>
+                </tr>
             [%- END %]
+        [%- END %]
     </tbody>
 </table>
 [% END %]