[open-ils-commits] [GIT] Evergreen ILS branch master updated. 2508f4dfee6322ca59af6791a98540a8c7cc3244

Evergreen Git git at git.evergreen-ils.org
Sun Jul 22 21:51:41 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  2508f4dfee6322ca59af6791a98540a8c7cc3244 (commit)
      from  428e36c9335aec96e2f6d5015bd01ae507825676 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2508f4dfee6322ca59af6791a98540a8c7cc3244
Author: Dan Scott <dan at coffeecode.net>
Date:   Sun Jul 22 18:58:11 2012 -0400

    Fix / improve bookbag list paging
    
    The prior code used CSS to hide elements, which is a bit weird given
    that we can simply avoid creating the element in the first place and
    keep the DOM a lot simpler.
    
    Also, the previous code was subject to some bugs if it wasn't given
    an explicit offset GET param or paging at the end of a list
    (particularly given that the LIMIT parameter ensured that the number of
    bookbags returned would always be equal to or less than the LIMIT
    parameter).
    
    Finally, the changes related the permanent bookbags didn't pass through
    one of the context parameters we needed (bookbag_count) to enable
    paging.
    
    Signed-off-by: Dan Scott <dan at coffeecode.net>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
index 07db754..10dd567 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm
@@ -1702,6 +1702,15 @@ sub load_myopac_bookbags {
     # We load the user prefs to get their default bookbag.
     $self->_load_user_with_prefs;
 
+    # We also want a total count of the user's bookbags.
+    my $q = {
+        'select' => { 'cbreb' => [ { 'column' => 'id', 'transform' => 'count', 'aggregate' => 'true', 'alias' => 'count' } ] },
+        'from' => 'cbreb',
+        'where' => { 'btype' => 'bookbag', 'owner' => $self->ctx->{user}->id }
+    };
+    my $r = $e->json_query($q);
+    $ctx->{bookbag_count} = $r->[0]->{'count'};
+
     # If the user wants a specific bookbag's items, load them.
     # XXX add bookbag item paging support
 
diff --git a/Open-ILS/src/templates/opac/myopac/lists.tt2 b/Open-ILS/src/templates/opac/myopac/lists.tt2
index e633688..651f990 100644
--- a/Open-ILS/src/templates/opac/myopac/lists.tt2
+++ b/Open-ILS/src/templates/opac/myopac/lists.tt2
@@ -63,13 +63,19 @@
     [% IF ctx.bookbags.size %]
     <div class="header_middle">
         <span class="float-left">[% l('Saved Lists') %]</span>
-        [% IF limit < ctx.bookbag_count %]
+        [% IF limit < ctx.bookbag_count; %]
         <span class='float-left' style='padding-left: 10px;'>
-            <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset - limit)}) %]'
-                [% IF offset == 0 %] class='invisible' [% END %]><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
-            <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {limit => limit, offset => (offset + limit)}) %]'
-               [% IF ctx.bookbags.size < limit %] class='invisible' [% END %] >[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
-        </span>
+            [%- IF offset > 0 -%]
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    limit => limit, offset => (offset - limit)
+                }) %]'><span class="nav_arrow_fix">&#9668;</span>[% l('Previous') %]</a>
+            [%- END; -%]
+            [%- IF (ctx.bookbag_count - offset) > limit; -%] 
+                <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+                    limit => limit, offset => (offset + limit)
+                }) %]'>[% l('Next') %]<span class="nav_arrow_fix">&#9658;</span></a>
+            </span>
+            [%- END; -%]
         [% END %]
     </div>
     <div class="clear-both"></div>

-----------------------------------------------------------------------

Summary of changes:
 .../lib/OpenILS/WWW/EGCatLoader/Account.pm         |    9 +++++++++
 Open-ILS/src/templates/opac/myopac/lists.tt2       |   18 ++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list