From: Dan Scott Date: Sun, 22 Jul 2012 22:58:11 +0000 (-0400) Subject: Fix / improve bookbag list paging X-Git-Tag: sprint4-merge-nov22~4090 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2508f4dfee6322ca59af6791a98540a8c7cc3244;p=working%2FEvergreen.git 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 Signed-off-by: Ben Shum --- 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 07db754d15..10dd567092 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 e633688f12..651f9908bc 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 %]