Bugzilla – Attachment 117726 Details for
Bug 27752
Correct ESLint errors in batchMod.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27752: Correct eslint errors in batchMod.js
Bug-27752-Correct-eslint-errors-in-batchModjs.patch (text/plain), 10.58 KB, created by
Katrin Fischer
on 2021-03-04 14:03:04 UTC
(
hide
)
Description:
Bug 27752: Correct eslint errors in batchMod.js
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-03-04 14:03:04 UTC
Size:
10.58 KB
patch
obsolete
>From abd5d815f2c88f66ca41268b4b4ad1b158ce764c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 22 Feb 2021 15:44:54 +0000 >Subject: [PATCH] Bug 27752: Correct eslint errors in batchMod.js > >This patch makes minor changes to batchMod.js in order to address errors >raised by ESLint. These changes include whitespace changes, so diff >accordingly. > >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. > >To confirm that ESLint is happy with the changes you could open the file >for editing using an editor with ESLint integration, or install ESLint >on the command line: >https://eslint.org/docs/user-guide/command-line-interface > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js | 191 +++++++++++----------- > 1 file changed, 96 insertions(+), 95 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js >index 4d15973fd1..f71cc3b102 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/batchMod.js >@@ -1,86 +1,86 @@ >+/* global dataTablesDefaults allColumns */ > // Set expiration date for cookies >- var date = new Date(); >- date.setTime(date.getTime()+(365*24*60*60*1000)); >- var expiration = date.toGMTString(); >+var date = new Date(); >+date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000)); > >- >-function hideColumns(){ >- valCookie = $.cookie("showColumns"); >- if(valCookie){ >- valCookie = valCookie.split("/"); >- $("#showall").prop("checked", false).parent().removeClass("selected"); >- for( i=0; i<valCookie.length; i++ ){ >- if(valCookie[i] !== ''){ >- index = valCookie[i] - 3; >- $("#itemst td:nth-child("+valCookie[i]+"),#itemst th:nth-child("+valCookie[i]+")").toggle(); >- $("#checkheader"+index).prop("checked", false).parent().removeClass("selected"); >- } >+function hideColumns() { >+ var valCookie = $.cookie("showColumns"); >+ if (valCookie) { >+ valCookie = valCookie.split("/"); >+ $("#showall").prop("checked", false).parent().removeClass("selected"); >+ for ( var i = 0; i < valCookie.length; i++ ) { >+ if (valCookie[i] !== '') { >+ var index = valCookie[i] - 3; >+ $("#itemst td:nth-child(" + valCookie[i] + "),#itemst th:nth-child(" + valCookie[i] + ")").toggle(); >+ $("#checkheader" + index).prop("checked", false).parent().removeClass("selected"); >+ } >+ } > } >- } > } > > function hideColumn(num) { >- $("#hideall,#showall").prop("checked", false).parent().removeClass("selected"); >- valCookie = $.cookie("showColumns"); >- // set the index of the table column to hide >- $("#"+num).parent().removeClass("selected"); >- var hide = Number(num.replace("checkheader","")) + 3; >- // hide header and cells matching the index >- $("#itemst td:nth-child("+hide+"),#itemst th:nth-child("+hide+")").toggle(); >- // set or modify cookie with the hidden column's index >- if(valCookie){ >- valCookie = valCookie.split("/"); >- var found = false; >- for( $i=0; $i<valCookie.length; $i++ ){ >- if (hide == valCookie[i]) { >- found = true; >- break; >+ $("#hideall,#showall").prop("checked", false).parent().removeClass("selected"); >+ var valCookie = $.cookie("showColumns"); >+ // set the index of the table column to hide >+ $("#" + num).parent().removeClass("selected"); >+ var hide = Number(num.replace("checkheader", "")) + 3; >+ // hide header and cells matching the index >+ $("#itemst td:nth-child(" + hide + "),#itemst th:nth-child(" + hide + ")").toggle(); >+ // set or modify cookie with the hidden column's index >+ if (valCookie) { >+ valCookie = valCookie.split("/"); >+ var found = false; >+ for ( var i = 0; i < valCookie.length; i++ ) { >+ if (hide == valCookie[i]) { >+ found = true; >+ break; >+ } > } >+ if (!found) { >+ valCookie.push(hide); >+ var cookieString = valCookie.join("/"); >+ $.cookie("showColumns", cookieString, { expires: date, path: '/' }); >+ } >+ } else { >+ $.cookie("showColumns", hide, { expires: date, path: '/' }); > } >- if( !found ){ >- valCookie.push(hide); >- var cookieString = valCookie.join("/"); >- $.cookie("showColumns", cookieString, { expires : date, path: '/' }); >- } >- } else { >- $.cookie("showColumns", hide, { expires : date, path: '/' }); >- } > } > > // Array Remove - By John Resig (MIT Licensed) > // http://ejohn.org/blog/javascript-array-remove/ >-Array.prototype.remove = function(from, to) { >- var rest = this.slice((to || from) + 1 || this.length); >- this.length = from < 0 ? this.length + from : from; >- return this.push.apply(this, rest); >+Array.prototype.remove = function (from, to) { >+ var rest = this.slice((to || from) + 1 || this.length); >+ this.length = from < 0 ? this.length + from : from; >+ return this.push.apply(this, rest); > }; > >-function showColumn(num){ >- $("#hideall").prop("checked", false).parent().removeClass("selected"); >- $("#"+num).parent().addClass("selected"); >- valCookie = $.cookie("showColumns"); >- // set the index of the table column to hide >- show = Number(num.replace("checkheader","")) + 3; >- // hide header and cells matching the index >- $("#itemst td:nth-child("+show+"),#itemst th:nth-child("+show+")").toggle(); >- // set or modify cookie with the hidden column's index >- if(valCookie){ >- valCookie = valCookie.split("/"); >- var found = false; >- for( i=0; i<valCookie.length; i++ ){ >- if (show == valCookie[i]) { >- valCookie.remove(i); >- found = true; >+function showColumn(num) { >+ $("#hideall").prop("checked", false).parent().removeClass("selected"); >+ $("#" + num).parent().addClass("selected"); >+ var valCookie = $.cookie("showColumns"); >+ // set the index of the table column to hide >+ var show = Number(num.replace("checkheader", "")) + 3; >+ // hide header and cells matching the index >+ $("#itemst td:nth-child(" + show + "),#itemst th:nth-child(" + show + ")").toggle(); >+ // set or modify cookie with the hidden column's index >+ if (valCookie) { >+ valCookie = valCookie.split("/"); >+ var found = false; >+ for ( var i = 0; i < valCookie.length; i++ ) { >+ if (show == valCookie[i]) { >+ valCookie.remove(i); >+ found = true; >+ } >+ } >+ if (found) { >+ var cookieString = valCookie.join("/"); >+ $.cookie("showColumns", cookieString, { expires: date, path: '/' }); > } > } >- if( found ){ >- var cookieString = valCookie.join("/"); >- $.cookie("showColumns", cookieString, { expires : date, path: '/' }); >- } >- } > } >-function showAllColumns(){ >- $("#selections input:checkbox").each(function(){ >+ >+function showAllColumns() { >+ $("#selections input:checkbox").each(function () { > $(this).prop("checked", true); > }); > $("#selections span").addClass("selected"); >@@ -88,59 +88,60 @@ function showAllColumns(){ > $.removeCookie("showColumns", { path: '/' }); > $("#hideall").prop("checked", false).parent().removeClass("selected"); > } >-function hideAllColumns(){ >- $("#selections input:checkbox").each(function(){ >+ >+function hideAllColumns() { >+ $("#selections input:checkbox").each(function () { > $(this).prop("checked", false); > }); > $("#selections span").removeClass("selected"); > $("#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: '/' }); >+ $.cookie("showColumns", cookieString, { expires: date, path: '/' }); > } > >- $(document).ready(function() { >+$(document).ready(function () { > hideColumns(); > $("#itemst").dataTable($.extend(true, {}, dataTablesDefaults, { > "sDom": 't', > "aoColumnDefs": [ >- { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >- { "sType": "anti-the", "aTargets" : [ "anti-the" ] } >+ { "aTargets": [0], "bSortable": false, "bSearchable": false }, >+ { "sType": "anti-the", "aTargets": ["anti-the"] } > ], > "bPaginate": false, > })); >- $("#selectallbutton").click(function(e){ >+ $("#selectallbutton").click(function (e) { > e.preventDefault(); >- $("#itemst input:checkbox").each(function(){ >+ $("#itemst input:checkbox").each(function () { > $(this).prop("checked", true); > }); > }); >- $("#clearallbutton").click(function(e){ >+ $("#clearallbutton").click(function (e) { > e.preventDefault(); >- $("#itemst input:checkbox").each(function(){ >+ $("#itemst input:checkbox").each(function () { > $(this).prop("checked", false); > }); > }); >- $("#clearonloanbutton").click(function(){ >- $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function(){ >- $(this).prop('checked', false); >- }); >- return false; >+ $("#clearonloanbutton").click(function () { >+ $("#itemst input[name='itemnumber'][data-is-onloan='1']").each(function () { >+ $(this).prop('checked', false); >+ }); >+ return false; > }); >- $("#selections input").change(function(e){ >- var num = $(this).attr("id"); >- if(num == 'showall'){ >- showAllColumns(); >- e.stopPropagation(); >- } else if(num == 'hideall'){ >- hideAllColumns(); >- e.stopPropagation(); >- } else { >- if($(this).prop("checked")){ >- showColumn(num); >+ $("#selections input").change(function (e) { >+ var num = $(this).attr("id"); >+ if (num == 'showall') { >+ showAllColumns(); >+ e.stopPropagation(); >+ } else if (num == 'hideall') { >+ hideAllColumns(); >+ e.stopPropagation(); > } else { >- hideColumn(num); >+ if ($(this).prop("checked")) { >+ showColumn(num); >+ } else { >+ hideColumn(num); >+ } > } >- } > }); >- }); >+}); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27752
:
117158
|
117230
| 117726