fixes #1433 saving the tags per page value in cookie + finxing some bugs in tag page

This commit is contained in:
Matthieu Leproux
2021-07-23 13:03:45 +02:00
parent f48ae4a5ef
commit f032a9f244
3 changed files with 43 additions and 10 deletions

View File

@@ -858,10 +858,10 @@ function updatePaginationMenu() {
actualPage = Math.min(actualPage, getNumberPages());
if (getNumberPages() > 1) {
$('.tag-pagination').show();
$('.pagination-container').show();
createPaginationMenu();
} else {
$('.tag-pagination').hide();
$('.pagination-container').hide();
}
updateArrows();
@@ -947,7 +947,7 @@ function updatePage() {
dataToDisplay = tagToDisplay();
tagBoxes = $('.tag-box');
$('.pageLoad').fadeIn();;
$('.tag-box, .tag-pagination').animate({opacity:0}, 500).promise().then(() => {
$('.tag-box').animate({opacity:0}, 500).promise().then(() => {
let displayTags = new Promise((res, rej) => {
boxToRecycle = Math.min(dataToDisplay.length, tagBoxes.length);
@@ -1006,16 +1006,19 @@ $('.pagination-arrow.left').on('click', () => {
})
if (getNumberPages() > 1) {
$('.tag-pagination').show();
$('.pagination-container').show();
createPaginationMenu();
updateArrows();
} else {
$('.tag-pagination').hide();
$('.pagination-container').hide();
}
$('.pagination-per-page a').on('click',function () {
per_page = parseInt($(this).html());
updatePaginationMenu();
$(".pagination-per-page .selected").removeClass("selected");
$(this).addClass("selected");
$.cookie("pwg_tags_per_page", per_page);
})
function updateSearchInfo () {
@@ -1029,4 +1032,14 @@ function updateSearchInfo () {
} else {
$('.search-info').html('');
}
}
}
$(function () {
function setPagination() {
let test = $.cookie("pwg_tags_per_page");
$(".pagination-per-page .selected").removeClass("selected");
$("#"+test).trigger("click");
}
setPagination()
})

View File

@@ -35,6 +35,7 @@ var str_tag_found = '{'<b>%d</b> tag found'|@translate}';
{combine_css path="admin/themes/default/fontello/css/animation.css" order=10} {* order 10 is required, see issue 1080 *}
{combine_script id='tiptip' load='header' path='themes/default/js/plugins/jquery.tipTip.minified.js'}
{combine_script id='tags' load='footer' path='admin/themes/default/js/tags.js'}
{combine_script id='jquery.cookie' path='themes/default/js/jquery.cookie.js' load='footer'}
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
@@ -167,10 +168,26 @@ var str_tag_found = '{'<b>%d</b> tag found'|@translate}';
<div class="tag-pagination">
<div class="pagination-per-page">
<span class="thumbnailsActionsShow" style="font-weight: bold;">{'Display'|@translate}</span>
<a>100</a>
<a>200</a>
<a>500</a>
<a>1000</a>
<a id="100"
{if $smarty.cookies.pwg_tags_per_page == 100 || !$smarty.cookies.pwg_tags_per_page}
class="selected"
{/if}
>100</a>
<a id="200"
{if $smarty.cookies.pwg_tags_per_page == 200}
class="selected"
{/if}
>200</a>
<a id="500"
{if $smarty.cookies.pwg_tags_per_page == 500}
class="selected"
{/if}
>500</a>
<a id="1000"
{if $smarty.cookies.pwg_tags_per_page == 1000}
class="selected"
{/if}
>1000</a>
</div>
<div class="pagination-container">

View File

@@ -2902,6 +2902,9 @@ a#showPermissions:hover {text-decoration: none;}
color: #ffa744;
}
.tag-pagination .selected {
background: #ffa646;
}
.tag-container .tag-box .tag-rename span {
padding: 2px 3px;