From e5ed68e6a8b4a8c0090b5e251207886b5ddb7da5 Mon Sep 17 00:00:00 2001 From: Matthieu Leproux Date: Wed, 12 May 2021 16:45:39 +0200 Subject: [PATCH] Fixes #1399 Added mesage at the end of result list if result limit reached Related to #1387 changed variables names for more clarity --- admin/cat_move.php | 2 +- admin/themes/default/template/cat_move.tpl | 2 -- admin/themes/default/template/cat_search.tpl | 23 +++++++++++++++++--- include/config_default.inc.php | 5 +++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/admin/cat_move.php b/admin/cat_move.php index 6ad272f01..b6a793b3e 100644 --- a/admin/cat_move.php +++ b/admin/cat_move.php @@ -121,7 +121,7 @@ $template->assign( ) ); -$template->assign('delay_before_autoOpen', $conf['delay_before_auto_openning']); +$template->assign('delay_before_autoOpen', $conf['album_move_delay_before_auto_opening']); // +-----------------------------------------------------------------------+ // | Album display | diff --git a/admin/themes/default/template/cat_move.tpl b/admin/themes/default/template/cat_move.tpl index 192cf23d1..0d4cfd8b9 100644 --- a/admin/themes/default/template/cat_move.tpl +++ b/admin/themes/default/template/cat_move.tpl @@ -14,8 +14,6 @@ var str_root = "{'Root'|@translate}" var openCat = {$open_cat}; var delay_autoOpen = {$delay_before_autoOpen} - -console.log(delay_autoOpen) {/footer_script} {combine_script id='jquery.confirm' load='footer' require='jquery' path='themes/default/js/plugins/jquery-confirm.min.js'} diff --git a/admin/themes/default/template/cat_search.tpl b/admin/themes/default/template/cat_search.tpl index 7f24b1df1..9cb92536c 100644 --- a/admin/themes/default/template/cat_search.tpl +++ b/admin/themes/default/template/cat_search.tpl @@ -16,12 +16,14 @@ const RESULT_LIMIT = 100; var str_albums_found = '{"%d albums found"|translate}'; var str_album_found = '{"1 album found"|translate}'; -var str_result_limit = '{"%d+ albums found, try to refine the search"|translate}'; +var str_result_limit = '{"%d+ albums found, try to refine the search"|translate|escape:javascript}'; {literal} var editLink = "admin.php?page=album-"; var colors = ["icon-red", "icon-blue", "icon-yellow", "icon-purple", "icon-green"]; +$(".limit-album-reached").hide(); + $('.search-input').on('input', () => { updateSearch(); }) @@ -31,6 +33,7 @@ function updateSearch () { string = $('.search-input').val(); $('.search-album-result').html(""); $('.search-album-noresult').hide(); + $(".limit-album-reached").hide(); if (string == '') { // help button unnecessary so do not show // $('.search-album-help').show(); @@ -44,8 +47,8 @@ function updateSearch () { nbResult = 0; categories.forEach((c) => { if (c[0].toString().toLowerCase().search(string.toLowerCase()) != -1 && nbResult < RESULT_LIMIT) { - addAlbumResult(c); nbResult++; + addAlbumResult(c, nbResult); } }) @@ -68,7 +71,7 @@ function updateSearch () { } // Add an album as a result in the page -function addAlbumResult (cat) { +function addAlbumResult (cat, nbResult) { id = cat[1][cat[1].length - 1]; template = $('.search-album-elem-template').html(); newCatNode = $(template); @@ -97,6 +100,11 @@ function addAlbumResult (cat) { newCatNode.find('.search-album-edit').attr('href', href); $('.search-album-result').append(newCatNode); + + if(nbResult >= RESULT_LIMIT) { + $(".limit-album-reached").show(1000); + $('.limit-album-reached').html(str_result_limit.replace('%d', nbResult)); + } } // Get the path "PARENT / parent / album" with link to the edition of all albums @@ -168,8 +176,17 @@ $('.search-input').focus();
+
{'No albums found'|translate}
+ + diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 3de4ba12c..246e84b5a 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -716,8 +716,9 @@ $conf['dashboard_check_for_updates'] = true; // Number Weeks displayed on activity chart on the dashboard $conf['dashboard_activity_nb_weeks'] = 4; -// Number of seconds before auto openning when dragging albums in milliseconds : 3 seconds by default -$conf['delay_before_auto_openning'] = 3*1000; +// On album mover page, number of seconds before auto openning album when +// dragging an album. In milliseconds. 3 seconds by default. +$conf['album_move_delay_before_auto_opening'] = 3*1000; // +-----------------------------------------------------------------------+ // | Filter |