From 5ca10bbfaeddd7b8b6c5243c2f4bd84354947e5b Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Mon, 20 Sep 2021 15:06:21 +0200 Subject: [PATCH] related to #1465 added hover on ip and user name + adjustments for labels and translation --- admin/themes/default/js/history.js | 26 +++++++++++++++++++---- admin/themes/default/template/history.tpl | 14 ++++++++++-- include/ws_functions/pwg.php | 3 --- language/en_UK/admin.lang.php | 3 ++- language/fr_FR/admin.lang.php | 3 ++- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index 5b0f71204..f73365a92 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -1,6 +1,7 @@ $(document).ready(() => { activateLineOptions(); + checkFilters(); $(".elem-type-select").on("change", function (e) { console.log($(".elem-type-select option:selected").attr("value")); @@ -71,6 +72,11 @@ $(document).ready(() => { current_param.pageNumber -= 1; fillHistoryResult(current_param); }); + + $(".refresh-results").on("click", function () { + $(this).addClass("animate-spin") + fillHistoryResult(current_param); + }) }) function activateLineOptions() { @@ -130,6 +136,7 @@ function fillHistoryResult(ajaxParam) { activateLineOptions(); $(".loading").addClass("hide"); updatePagination(maxPage); + $(".refresh-results").removeClass("animate-spin") }) } @@ -303,10 +310,11 @@ function addUserFilter(username) { current_param.user = "-1"; current_param.pageNumber = 0; fillHistoryResult(current_param); - + checkFilters(); }) $(".filter-container").append(newFilter); + checkFilters(); } function addIpFilter(ip) { @@ -322,16 +330,17 @@ function addIpFilter(ip) { current_param.ip = ""; current_param.pageNumber = 0; fillHistoryResult(current_param); - + checkFilters(); }) $(".filter-container").append(newFilter); + checkFilters(); } function addImageFilter(img_id) { var newFilter = $("#default-filter").clone(); newFilter.removeClass("hide"); - + newFilter.find(".filter-title").html("Image #" + img_id); newFilter.find(".filter-icon").addClass("icon-picture"); @@ -341,10 +350,11 @@ function addImageFilter(img_id) { current_param.image_id = ""; current_param.pageNumber = 0; fillHistoryResult(current_param); - + checkFilters(); }) $(".filter-container").append(newFilter); + checkFilters(); } function updateArrows(actualPage, maxPage) { @@ -369,3 +379,11 @@ function updatePagination(maxPage) { ""+ (current_param.pageNumber+1) +"" ) } + +function checkFilters() { + if ($(".filter-container")[0].childElementCount - 1 > 0) { //Check if there are filters + $(".filter-tags label").show(); + } else { + $(".filter-tags label").hide(); + } +} \ No newline at end of file diff --git a/admin/themes/default/template/history.tpl b/admin/themes/default/template/history.tpl index 0acec9f88..d514bba8c 100644 --- a/admin/themes/default/template/history.tpl +++ b/admin/themes/default/template/history.tpl @@ -73,7 +73,7 @@ const str_recent_pics = "{'Recent photos'|translate}";