From f20bc5bbc36aafc1bc9412ab2c1a71054e51945b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 22 Feb 2021 16:49:12 +0000 Subject: [PATCH] Bug 27751: Phase out jquery.cookie.js: Batch item modifications To test, apply the patch and go to Tools -> Batch item modification. - Submit a batch of barcodes for modification. - Uncheck some checkboxes to hide columns in the table showing your submitted items. - Return to the batch item modification page and submit your batch again. - The columns you selected should still be hidden. - Submit a batch of items for deletion. - The same columns should be hidden here too. - Also test that the "Show all columns" and "Hide all columns" buttons work and that the changes persist across batches. --- koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js index f71cc3b102..4816036d3e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js @@ -1,10 +1,10 @@ -/* global dataTablesDefaults allColumns */ +/* global dataTablesDefaults allColumns Cookies */ // Set expiration date for cookies var date = new Date(); date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000)); function hideColumns() { - var valCookie = $.cookie("showColumns"); + var valCookie = Cookies.get("showColumns"); if (valCookie) { valCookie = valCookie.split("/"); $("#showall").prop("checked", false).parent().removeClass("selected"); @@ -20,7 +20,7 @@ function hideColumns() { function hideColumn(num) { $("#hideall,#showall").prop("checked", false).parent().removeClass("selected"); - var valCookie = $.cookie("showColumns"); + var valCookie = Cookies.get("showColumns"); // set the index of the table column to hide $("#" + num).parent().removeClass("selected"); var hide = Number(num.replace("checkheader", "")) + 3; @@ -39,10 +39,10 @@ function hideColumn(num) { if (!found) { valCookie.push(hide); var cookieString = valCookie.join("/"); - $.cookie("showColumns", cookieString, { expires: date, path: '/' }); + Cookies.set("showColumns", cookieString, { expires: date, path: '/' }); } } else { - $.cookie("showColumns", hide, { expires: date, path: '/' }); + Cookies.set("showColumns", hide, { expires: date, path: '/' }); } } @@ -57,7 +57,7 @@ Array.prototype.remove = function (from, to) { function showColumn(num) { $("#hideall").prop("checked", false).parent().removeClass("selected"); $("#" + num).parent().addClass("selected"); - var valCookie = $.cookie("showColumns"); + var valCookie = Cookies.get("showColumns"); // set the index of the table column to hide var show = Number(num.replace("checkheader", "")) + 3; // hide header and cells matching the index @@ -74,7 +74,7 @@ function showColumn(num) { } if (found) { var cookieString = valCookie.join("/"); - $.cookie("showColumns", cookieString, { expires: date, path: '/' }); + Cookies.set("showColumns", cookieString, { expires: date, path: '/' }); } } } @@ -97,7 +97,7 @@ function hideAllColumns() { $("#itemst td:nth-child(3),#itemst th:nth-child(3)").nextAll().hide(); $("#hideall").prop("checked", true).parent().addClass("selected"); var cookieString = allColumns.join("/"); - $.cookie("showColumns", cookieString, { expires: date, path: '/' }); + Cookies.set("showColumns", cookieString, { expires: date, path: '/' }); } $(document).ready(function () { -- 2.11.0