1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

#680 - added auto organize page

This commit is contained in:
Luke Pulverenti 2014-01-21 01:10:58 -05:00
parent fda9b3d93d
commit 9ab4adcd33
10 changed files with 481 additions and 159 deletions

View file

@ -1426,7 +1426,7 @@
return html;
},
getPagingHtml: function (query, totalRecordCount, updatePageSizeSetting, pageSizes) {
getPagingHtml: function (query, totalRecordCount, updatePageSizeSetting, pageSizes, showLimit) {
if (query.Limit && updatePageSizeSetting !== false) {
localStorage.setItem('pagesize', query.Limit);
@ -1451,7 +1451,7 @@
var recordsEnd = Math.min(query.StartIndex + query.Limit, totalRecordCount);
// 20 is the minimum page size
var showControls = totalRecordCount > 20;
var showControls = totalRecordCount > 20 || query.Limit < totalRecordCount;
html += '<div class="listPaging">';
@ -1461,39 +1461,44 @@
html += startAtDisplay + '-' + recordsEnd + ' of ' + totalRecordCount;
if (showControls) {
html += ', page ' + dropdownHtml + ' of ' + pageCount;
//html += ', page ' + dropdownHtml + ' of ' + pageCount;
}
html += '</span>';
if (showControls) {
html += '<div data-role="controlgroup" data-type="horizontal" style="display:inline-block;">';
html += '<button data-icon="arrow-l" data-iconpos="notext" data-inline="true" data-mini="true" class="btnPreviousPage" ' + (query.StartIndex ? '' : 'disabled') + '>Previous Page</button>';
html += '<button data-icon="arrow-r" data-iconpos="notext" data-inline="true" data-mini="true" class="btnNextPage" ' + (query.StartIndex + query.Limit > totalRecordCount ? 'disabled' : '') + '>Next Page</button>';
html += '</div>';
var id = "selectPageSize" + new Date().getTime();
if (showLimit !== false) {
var id = "selectPageSize" + new Date().getTime();
var options = '';
var options = '';
function getOption(val) {
function getOption(val) {
if (query.Limit == val) {
if (query.Limit == val) {
return '<option value="' + val + '" selected="selected">' + val + '</option>';
return '<option value="' + val + '" selected="selected">' + val + '</option>';
} else {
return '<option value="' + val + '">' + val + '</option>';
} else {
return '<option value="' + val + '">' + val + '</option>';
}
}
pageSizes = pageSizes || [20, 50, 100, 200, 300, 400, 500];
for (var j = 0, length = pageSizes.length; j < length; j++) {
options += getOption(pageSizes[j]);
}
// Add styles to defeat jquery mobile
html += '<label style="display:inline;font-size:inherit;" class="labelPageSize" for="' + id + '">Limit: </label><select class="selectPageSize" id="' + id + '" data-enhance="false" data-role="none">' + options + '</select>';
}
pageSizes = pageSizes || [20, 50, 100, 200, 300, 400, 500];
for (var j = 0, length = pageSizes.length; j < length; j++) {
options += getOption(pageSizes[j]);
}
// Add styles to defeat jquery mobile
html += '<label style="display:inline;font-size:inherit;" class="labelPageSize" for="' + id + '">Limit: </label><select class="selectPageSize" id="' + id + '" data-enhance="false" data-role="none">' + options + '</select>';
}
html += '</div>';