[Bug 35062] New: addbiblio: Allow a framework plugin to add class to prevent submit during ajax call
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Bug ID: 35062 Summary: addbiblio: Allow a framework plugin to add class to prevent submit during ajax call Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: m.de.rooy@rijksmuseum.nl QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl I have a plugin that does a REST API call wrapped in an ajax construct: jQuery.ajax({ rest api stuff }).done(function() ...).fail(function() ...); Rapidly clicking Save (while the ajax is triggered by the Change event) lets the plugin shortly show an error before the form submits. Which is obviously undesirable. If we would replace this in addbiblio.tt: var onOption = function () { - return Check(); + if ( $('.plugin-blocks-submit').length==0 ) return Check(); } We can conditionally and temporarily block submittal. When the change event of the plugin fires, I add class plugin-no-submit to the html element involved. In the done and fail functions I remove the class again from the element. This effectively works. While several other approaches in addbiblio failed. (Removing the event handler is just too late.) This is a one-liner that will do the job. On bug 34860 I will still submit a ISBN/ISSN plugin using this class that will demonstrate its use. In the meantime this is a harmless check. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Actually, is it better move the condition to function Check itself. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |m.de.rooy@rijksmuseum.nl |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 --- Comment #2 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 157226 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157226&action=edit Bug 35062: Add class plugin-blocks-submit in addbiblio Adding this condition in Check() allows you to prevent form submittal during e.g. an ajax call in a framework plugin. The plugin adds and removes the class on the corresponding html element during processing. Test plan: Since we do not have a plugin using this class yet, nothing changes now. Verify that you can still click Save in addbiblio while using standard plugins. In other words: no change in behavior. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |34860 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34860 [Bug 34860] New framework plugin for ISBN/ISSN -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #157226|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 157873 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=157873&action=edit Bug 35062: Add class plugin-blocks-submit in addbiblio Adding this condition in Check() allows you to prevent form submittal during e.g. an ajax call in a framework plugin. The plugin adds and removes the class on the corresponding html element during processing. Test plan: Since we do not have a plugin using this class yet, nothing changes now. Verify that you can still click Save in addbiblio while using standard plugins. In other words: no change in behavior. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to David Nind from comment #3)
Signed-off-by: David Nind <david@davidnind.com>
Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #157873|0 |1 is obsolete| | --- Comment #5 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 160936 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=160936&action=edit Bug 35062: Add class plugin-blocks-submit in addbiblio Adding this condition in Check() allows you to prevent form submittal during e.g. an ajax call in a framework plugin. The plugin adds and removes the class on the corresponding html element during processing. Test plan: Since we do not have a plugin using this class yet, nothing changes now. Verify that you can still click Save in addbiblio while using standard plugins. In other words: no change in behavior. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|addbiblio: Allow a |Allow a framework plugin to |framework plugin to add |add class to prevent submit |class to prevent submit |during ajax call |during ajax call | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Needs documenting CC| |fridolin.somers@biblibre.co | |m --- Comment #7 from Fridolin Somers <fridolin.somers@biblibre.com> --- Not backported to 23.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35062 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs documenting |RESOLVED CC| |caroline.cyr-la-rose@inlibr | |o.com --- Comment #8 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Architecture change, nothing to add/edit in the Koha manual. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org