Bugzilla – Attachment 76189 Details for
Bug 17602
Integrate support for RecordedBooks (formerly OneClickDigital) API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17602: fix RecordedBooks results pagination
Bug-17602-fix-RecordedBooks-results-pagination.patch (text/plain), 3.33 KB, created by
Jonathan Druart
on 2018-06-19 18:56:29 UTC
(
hide
)
Description:
Bug 17602: fix RecordedBooks results pagination
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-06-19 18:56:29 UTC
Size:
3.33 KB
patch
obsolete
>From 07fabe12930029b3a2d9392a731304503caf2c34 Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Mon, 27 Nov 2017 17:38:02 +1300 >Subject: [PATCH] Bug 17602: fix RecordedBooks results pagination > >--- > .../bootstrap/en/modules/opac-recordedbooks-search.tt | 13 +++++++++---- > koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js | 19 +++++++++++++++++-- > 2 files changed, 26 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt >index 07c9f05cc7..b384b964c2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt >@@ -121,16 +121,21 @@ function search( page ) { > > var pages = []; > >- var max_page = Math.floor( data.total / results_per_page ); >+ var max_page; >+ if (data.pages) { >+ max_page = data.pages - 1; >+ } else { >+ max_page = Math.floor( data.total / results_per_page ); >+ } > if (data.total == page*results_per_page) max_page++; > >- if ( page != 1 ) { >+ if ( page > 1 ) { > pages.push( '<li><a class="od-nav" href="#" data-page="' + (page - 1) + '">« ' + MSG_PREVIOUS + '</a></li>' ); > } > >- for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) { >+ for ( var p = Math.max( 1, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) { > if ( p == page ) { >- pages.push( ' <li class="active"><a href="#">' + ( p + 1 ) + '</a></li>' ); >+ pages.push( ' <li class="active"><a href="#">' + p + '</a></li>' ); > } else { > pages.push( ' <li><a class="od-nav" href="#" data-page="' + p + '">' + p + '</a></li>' ); > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js >index b0aeccb29d..a6ac515583 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js >@@ -313,8 +313,23 @@ KOHA.RecordedBooks = new function() { > results = data.results; > if (!results.total) { > var total = results.items.length; >- if ( total == results.page_size ) total = total + "+"; >- results.total = total; >+ if (results.pages) { >+ results.total = (results.pages - 1) * results.page_size; >+ if ( page && page == results.pages ) { >+ results.total = results.total + total; >+ } else { >+ results.total = (results.total + 1) + "+"; >+ } >+ } else { >+ if (!page) page = 1; >+ results.total = (page - 1) * results.page_size + total; >+ if ( total == results.page_size ) { >+ results.total = results.total + "+"; >+ results.pages = page + 1; >+ } else { >+ results.pages = page; >+ } >+ } > } > } > else results = {}; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17602
:
57402
|
57403
|
57404
|
60855
|
60856
|
60857
|
61866
|
61932
|
62247
|
62248
|
62249
|
62250
|
63392
|
63778
|
63779
|
63780
|
63857
|
64070
|
64071
|
64095
|
64096
|
64098
|
64099
|
64100
|
65988
|
65989
|
66341
|
66342
|
66343
|
67236
|
67237
|
67238
|
67240
|
67859
|
67860
|
69019
|
69020
|
69021
|
69022
|
69023
|
69024
|
69025
|
69026
|
69027
|
69101
|
69357
|
69358
|
69359
|
73708
|
73709
|
73710
|
73711
|
73712
|
73713
|
73714
|
73715
|
73716
|
73717
|
73718
|
73719
|
73725
|
76180
|
76181
|
76182
|
76183
|
76184
|
76185
|
76186
|
76187
|
76188
|
76189
|
76190
|
76191
|
76192
|
76193
|
78602
|
78603
|
78604
|
78605
|
78606
|
78607
|
78608
|
78609
|
78610
|
78611
|
78612
|
78613
|
78614
|
78615
|
79247
|
79668
|
79669
|
79670
|
79671
|
79672
|
79673
|
79674
|
79675
|
79676
|
79677
|
79678
|
79679
|
79680
|
79681
|
79682
|
79752