Created attachment 50253 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT
This patch violates the newly approved and newly added to the wiki (as of yesterday) coding guideline JS9: "Avoid the use of event attributes like "onclick" to attach events." https://wiki.koha-community.org/wiki/Coding_Guidelines#JS9:_Avoid_the_use_of_event_attributes_like_.22onclick.22_to_attach_events There is a simple function in staff-global.js which seems to be seldom used, but it could be in this case: function confirmDelete(message) { return (confirm(message) ? true : false); } --- $(document).ready(function(){ $(".delete_rule").on("click",function(){ return confirmDelete(MSG_CONFIRM_DELETE); }); }); I have started the process of tracking down and cleaning up use of "onclick" (See Bug 16262) but there are many templates to fix.
(In reply to Owen Leonard from comment #2) > This patch violates the newly approved and newly added to the wiki (as of > yesterday) coding guideline JS9: "Avoid the use of event attributes like > "onclick" to attach events." > > https://wiki.koha-community.org/wiki/Coding_Guidelines#JS9: > _Avoid_the_use_of_event_attributes_like_.22onclick.22_to_attach_events > > There is a simple function in staff-global.js which seems to be seldom used, > but it could be in this case: > > function confirmDelete(message) { > return (confirm(message) ? true : false); > } > > --- > > $(document).ready(function(){ > $(".delete_rule").on("click",function(){ > return confirmDelete(MSG_CONFIRM_DELETE); > }); > }); > > I have started the process of tracking down and cleaning up use of "onclick" > (See Bug 16262) but there are many templates to fix. Ah thanks for bringing this to my attention. I recently had a few patches pass QA where I was using the onclick attribute for confirm messages.
Created attachment 50301 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT
Created attachment 50502 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT Works as expected. Signed-off-by: Marc Véron <veron@veron.ch>
I don't think the confirmUnsetDel function is useful. We do not need a refactoring such trivial code.
Created attachment 50602 [details] [review] [PASSED QA] Bug 16268: Add confirm message for deleting circ and fines rules To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT Works as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Sorry, I had missed Jonathan's comment - Aleisha, could you take a look?
Created attachment 50670 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules EDIT: Removes unnecessary code and uses confirm message in staff-global.js To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT
Created attachment 50706 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules EDIT: Removes unnecessary code and uses confirm message in staff-global.js To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT Signed-off-by: Marc Véron <veron@veron.ch>
Created attachment 50727 [details] [review] Bug 16268: Add confirm message for deleting circ and fines rules EDIT: Removes unnecessary code and uses confirm message in staff-global.js To test: 1) Apply 16267 2) Go to Admin -> Circ and fines rules 3) Try clicking on Delete and Unset buttons 4) Confirm a confirm message pops up and works as expected Sponsored-by: Catalyst IT Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed to master! Will be in the May 2016 release! Kiitos Aleisha!