Tpac: paging support for serials issues (non-MFHD) user/senator/tpac-issues-held-paging
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 17 Nov 2011 21:35:20 +0000 (16:35 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Thu, 17 Nov 2011 21:37:40 +0000 (16:37 -0500)
When you click "issues held," when using the
opac.fully_compressed_serial_holdings org unit setting so that you get a
list of individual issuances you can potentially place holds on, now
there's some basic forward/back paging with a default page size of 10.

Thought this was done a while ago, but I must have been crazy.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/config.tt2
Open-ILS/src/templates/opac/parts/record/issues.tt2
Open-ILS/web/css/skin/default/opac/style.css

index e110472..db78681 100644 (file)
@@ -57,4 +57,9 @@ reset_password = 'true';
 record.summary.jacket_size = 'medium';
 
 
+##############################################################################
+# number of issues to show per page for serials
+# (only effective with OU setting opac.fully_compressed_serial_holdings true)
+holding_limit = 10;
+
 %]
index f346587..91505fa 100644 (file)
@@ -1,11 +1,18 @@
 <div class='rdetail_extras_div'>
 [%
-base_expando = ctx.full_path _ "?expand=issues";
 FOREACH type IN ctx.holding_summaries.keys;
     NEXT UNLESS ctx.holding_summaries.$type.size;
-    expanded = CGI.param('expand_holding_type') == type; %]
+    expanded = CGI.param('expand_holding_type') == type;
+    expander_params = {expand => 'issues', holding_limit => holding_limit};
+    IF expanded;
+        expander_omit = ['expand_holding_type'];
+    ELSE;
+        expander_omit = [];
+        expander_params.expand_holding_type = type;
+    END;
+    expander_url = mkurl('', expander_params, expander_omit); %]
     <div class="rdetail-issue-type">
-        <a href="[% base_expando; expanded ? '' : '&amp;expand_holding_type=' _ type; %]#issues">[[% expanded ? '-' : '+' %]]</a>
+        <a href="[% expander_url %]#issues">[[% expanded ? '-' : '+' %]]</a>
         [% ctx.holding_summaries.$type.join(", ") %]
         [% IF expanded %]
         <table>
@@ -21,6 +28,19 @@ FOREACH type IN ctx.holding_summaries.keys;
             </tr>
             [% END %]
         </table>
+        <div>
+        [% IF CGI.param("holding_offset");
+            prev_offset = CGI.param("holding_offset") - holding_limit;
+            IF prev_offset < 0; prev_offset = 0; END %]
+            <a class="holding-paging" href="[% mkurl('', {'holding_offset' => prev_offset, 'holding_limit' => holding_limit}) %]">
+                [% l("More recent holdings") %]</a>
+        [% END %]
+        [% IF ctx.expanded_holdings.size == holding_limit;
+            next_offset = (CGI.param("holding_offset") || 0) + holding_limit %]
+            <a class="holding-paging" href="[% mkurl('', {'holding_offset' => next_offset, 'holding_limit' => holding_limit}) %]">
+                [% l("Earlier holdings") %]</a>
+        [% END %]
+        </div>
         [% END %]
     </div>
 [% END %]
index e81b9d6..186b9bc 100644 (file)
@@ -1175,3 +1175,5 @@ table.bookbag-specific {
 #staff-saved-search { /* wraps .saved-searches-header and .saved-searches on the record page */
     border-right: 1px solid #333;
 }
+a.holding-paging { margin: 0 2em; }
+.rdetail-issue-type table { margin-left: 2em; }