From 261ce76f898a5618212ce0028958a022e77b034f Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 22 Jul 2012 18:58:11 -0400 Subject: [PATCH] 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 --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 9 +++++++++ Open-ILS/src/templates/opac/myopac/lists.tt2 | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) 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 %]
-- 2.11.0