# 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
[% 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">◄</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">►</span></a>
- </span>
+ [%- IF offset > 0 -%]
+ <a href='[% mkurl(ctx.opac_root _ '/myopac/lists', {
+ limit => limit, offset => (offset - limit)
+ }) %]'><span class="nav_arrow_fix">◄</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">►</span></a>
+ </span>
+ [%- END; -%]
[% END %]
</div>
<div class="clear-both"></div>