Fix #1051 Bug - Media Manager Pagination
This commit is contained in:
parent
8194be5e4d
commit
8d2056dfac
|
@ -51,13 +51,7 @@ $numberOfPages = count($listOfFilesByPage);
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- Paginator -->
|
<!-- Paginator -->
|
||||||
<nav>
|
<nav id="jsbluditMediaTablePagination"></nav>
|
||||||
<ul class="pagination justify-content-center flex-wrap">
|
|
||||||
<?php for ($i=1; $i<=$numberOfPages; $i++): ?>
|
|
||||||
<li class="page-item"><button type="button" class="btn btn-link page-link" onClick="getFiles(<?php echo $i ?>)"><?php echo $i ?></button></li>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -94,7 +88,7 @@ function hideMediaAlert() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the files in the table
|
// Show the files in the table
|
||||||
function displayFiles(files) {
|
function displayFiles(files, numberOfPages = <?= $numberOfPages ?>) {
|
||||||
if (!Array.isArray(files)) {
|
if (!Array.isArray(files)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -121,10 +115,19 @@ function displayFiles(files) {
|
||||||
'<\/tr>';
|
'<\/tr>';
|
||||||
$('#jsbluditMediaTable').append(tableRow);
|
$('#jsbluditMediaTable').append(tableRow);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mediaPagination = '<ul class="pagination justify-content-center flex-wrap">';
|
||||||
|
for (var i = 1; i <= numberOfPages; i++) {
|
||||||
|
mediaPagination += '<li class="page-item"><button type="button" class="btn btn-link page-link" onClick="getFiles('+i+')">'+i+'</button></li>';
|
||||||
|
}
|
||||||
|
mediaPagination += '</ul>';
|
||||||
|
$('#jsbluditMediaTablePagination').html(mediaPagination);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (files.length == 0) {
|
if (files.length == 0) {
|
||||||
$('#jsbluditMediaTable').html("<p><?php (IMAGE_RESTRICT ? $L->p('There are no images for the page') : $L->p('There are no images')) ?></p>");
|
$('#jsbluditMediaTable').html("<p><?php (IMAGE_RESTRICT ? $L->p('There are no images for the page') : $L->p('There are no images')) ?></p>");
|
||||||
|
$('#jsbluditMediaTablePagination').html('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +141,7 @@ function getFiles(pageNumber) {
|
||||||
},
|
},
|
||||||
function(data) { // success function
|
function(data) { // success function
|
||||||
if (data.status==0) {
|
if (data.status==0) {
|
||||||
displayFiles(data.files);
|
displayFiles(data.files, data.numberOfPages);
|
||||||
} else {
|
} else {
|
||||||
console.log(data.message);
|
console.log(data.message);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue