From 7202ef2a47d37c78c6b1664e2866efdeed96682f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 4 Mar 2021 15:50:14 +0000 Subject: [PATCH] Bug 5697: (follow-up) Save the user's choice to show or hide auto-links This patch adds local storage of the user's selection when they click the "Show/hide data menus" control. The selection persists until the user logs out. To test, apply the patch and run an SQL report which will return borrowernumber, cardnumber, itemnumber, or biblionumber. - When the results display, confirm that these numbers are shown with the auto-link menu. - Click the "Hide data menus" link. The text should change to "Show data menus" and the menus should disappear. - Navigate away from the page and re-run the report. - The menus should be automatically hidden in the results. - Log out of the staff client, return to saved reports, and run the report again. - The auto-link menus should appear. Signed-off-by: Katrin Fischer Signed-off-by: Katrin Fischer --- .../prog/en/modules/reports/guided_reports_start.tt | 15 +++++++++++++-- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index b91f2d2445..edae45d55a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1006,10 +1006,11 @@ [% END %] - + - Toggle data menus + + Hide data menus

[% END # /IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %] @@ -1903,8 +1904,18 @@ } $("#toggle_auto_links").on("click", function(e){ e.preventDefault(); + if( $(".data-plain").is(":visible") ){ + /* if a data-plain element is visible, this click hides it and shows auto-links */ + localStorage.removeItem("reports_auto_link_off"); + } else { + /* if a data-plain element is hidden, this click shows it and hides auto-links */ + localStorage.setItem("reports_auto_link_off", 1); + } $(".data-plain,.autolink").toggle(); }); + if ( localStorage.getItem("reports_auto_link_off") == 1 ){ + $("#toggle_auto_links").click(); + } }); function tabsInit( ui, rtable ){ diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 4f06af9465..98aa77b208 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -198,6 +198,7 @@ function logOut(){ clearHoldFor(); removeLastBorrower(); localStorage.removeItem("sql_reports_activetab"); + localStorage.removeItem("reports_auto_link_off"); localStorage.removeItem("searches"); } -- 2.11.0