HFP-1317 Made library detail pager behave good

pull/42/head
Paal Joergensen 2017-08-07 16:38:09 +02:00
parent f112f761c3
commit 7c3a322fda
1 changed files with 64 additions and 73 deletions

View File

@ -93,10 +93,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
* Creates the pager element on the bottom of the list * Creates the pager element on the bottom of the list
*/ */
H5PLibraryDetails.createPagerElement = function () { H5PLibraryDetails.createPagerElement = function () {
// Only create pager if needed:
if(H5PLibraryDetails.currentContent.length > H5PLibraryDetails.PAGER_SIZE) {
H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>'); H5PLibraryDetails.$previous = $('<button type="button" class="previous h5p-admin"><</button>');
H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>'); H5PLibraryDetails.$next = $('<button type="button" class="next h5p-admin">></button>');
@ -174,7 +170,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
}); });
H5PLibraryDetails.updatePager(); H5PLibraryDetails.updatePager();
}
}; };
/** /**
@ -188,10 +183,6 @@ var H5PLibraryDetails= H5PLibraryDetails || {};
* Update the pager text, and enables/disables the next and previous buttons as needed * Update the pager text, and enables/disables the next and previous buttons as needed
*/ */
H5PLibraryDetails.updatePager = function () { H5PLibraryDetails.updatePager = function () {
if (!H5PLibraryDetails.$pagerInfo) {
return; // No pager available
}
H5PLibraryDetails.$pagerInfo.css({display: 'inline-block'}); H5PLibraryDetails.$pagerInfo.css({display: 'inline-block'});
if(H5PLibraryDetails.getNumPages() > 0) { if(H5PLibraryDetails.getNumPages() > 0) {