[Bug 42094] New: Tidy all script tags
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug ID: 42094 Summary: Tidy all script tags Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart@gmail.com Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Depends on: 41324 On bug 41324 we tidy all the script tags that contained a kohaTable. Now we would like to tidy all the remaining script tags. We will certainly need a comment in the code to flag the script tag that is used to interpolate TT variables into JS variable. ``` <script> // Accept TT tags here let js_variable = [% perl_variable %]; </script> <script> // Here TT tags are prohibided, and ideally the code must be moved to a separate .js file // And we can reuse js_variable </script> ``` Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41324 [Bug 41324] Tidy kohaTable block -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #1 from David Cook <dcook@prosentient.com.au> --- I quite like the Mozilla dev guide model you mention in the 2026 Overview you presented at Hackfest, Jonathan. <script id="data" type="application/json"> [% To.json(data) | $raw %]; // Or [% data | json %] </script> <script> const userInfo = JSON.parse(document.getElementById("data").text); </script> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to David Cook from comment #1)
I quite like the Mozilla dev guide model you mention in the 2026 Overview you presented at Hackfest, Jonathan.
Yes I know, you are the one who pointed it to me! ;) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #2)
(In reply to David Cook from comment #1)
I quite like the Mozilla dev guide model you mention in the 2026 Overview you presented at Hackfest, Jonathan.
Yes I know, you are the one who pointed it to me! ;)
Haha I figured I'd just record it here in case people were interested 😅 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Was there discussion about it and how did it go? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to David Cook from comment #4)
Was there discussion about it and how did it go?
Yes, we are going to do it. I have a branch almost ready. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |41653 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41653 [Bug 41653] Stores for permissions and sysprefs should be under the Koha namespace -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #5)
(In reply to David Cook from comment #4)
Was there discussion about it and how did it go?
Yes, we are going to do it. I have a branch almost ready.
Which method? Or are we using both? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to David Cook from comment #6)
(In reply to Jonathan Druart from comment #5)
(In reply to David Cook from comment #4)
Was there discussion about it and how did it go?
Yes, we are going to do it. I have a branch almost ready.
Which method? Or are we using both?
No new method, the current one. Given the size of the diff we want the easiest to test and less disruptive changes as possible. After this is done we could start using `type="application/json"` for some of the regular JS variables (*_table_settings for instance). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Tidy all script tags |Tidy all script tags | |(except value_builder) --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- I am excluding cataloguing/value_builder files for this bug report. They are very messy and not trivial to migrate, and I don't want to delay the current work because of them. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42278 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42278 [Bug 42278] Tidy all script tags - circ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42280 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42280 [Bug 42280] Tidy all script tags - admin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42281 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42281 [Bug 42281] Tidy all script tags - authorities -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42282 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42282 [Bug 42282] Tidy all script tags - catalogue -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42284 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42284 [Bug 42284] Tidy all script tags - addbiblio/authorities -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42285 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42285 [Bug 42285] Tidy all script tags - authorities -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42286 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42286 [Bug 42286] Tidy all script tags - ill -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42288 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42288 [Bug 42288] Tidy all script tags - reserve -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42289 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42289 [Bug 42289] Tidy all script tags - tools -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42290 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42290 [Bug 42290] Tidy all script tags - suggestion -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42291 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42291 [Bug 42291] Tidy all script tags - shelves -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42292 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42292 [Bug 42292] Tidy all script tags - opac -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42293 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42293 [Bug 42293] Tidy all script tags - serials -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42294 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42294 [Bug 42294] Tidy all script tags - patron searches -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42295 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42295 [Bug 42295] Tidy all script tags - includes staff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42296 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42296 [Bug 42296] Tidy all script tags - trivial ones -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42285, which changed state. Bug 42285 Summary: Tidy all script tags - authorities https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42285 What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |DUPLICATE -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #9 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196809 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196809&action=edit Bug 42094: Adjust tests Rename xt/tt_kohaTable_tidy.t to xt/tt_script_tidy.t We now test all .tt and .inc files, except cataloguing/value_builder files. They are very messy and not trivial to migrate. Test plan: If you have applied all patches from the dependeng bug reports this test should now pass. We are testing that: * All files has only ONE script tag with the attribute data-tt-allowed set to "true" * All script tags with data-tt-allowed="true" have TT tags * All script tags without data-tt-allowed="true" do not have TT tags -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196810 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196810&action=edit Bug 42094: Fix occurrence in t Patch from commit 927b96f -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #11 from Jonathan Druart <jonathan.druart@gmail.com> --- The whole tree is available at https://gitlab.com/joubu/Koha/-/commits/bug_42094 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196809|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196810|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196909 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196909&action=edit Bug 42094: Adjust tests Rename xt/tt_kohaTable_tidy.t to xt/tt_script_tidy.t We now test all .tt and .inc files, except cataloguing/value_builder files. They are very messy and not trivial to migrate. Test plan: If you have applied all patches from the dependeng bug reports this test should now pass. We are testing that: * All files has only ONE script tag with the attribute data-tt-allowed set to "true" * All script tags with data-tt-allowed="true" have TT tags * All script tags without data-tt-allowed="true" do not have TT tags -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196910 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196910&action=edit Bug 42094: Fix occurrence in t Patch from commit 8b5eaa2 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196909|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #196910|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196911&action=edit Bug 42094: Adjust tests Rename xt/tt_kohaTable_tidy.t to xt/tt_script_tidy.t We now test all .tt and .inc files, except cataloguing/value_builder files. They are very messy and not trivial to migrate. Test plan: If you have applied all patches from the dependeng bug reports this test should now pass. We are testing that: * All files has only ONE script tag with the attribute data-tt-allowed set to "true" * All script tags with data-tt-allowed="true" have TT tags * All script tags without data-tt-allowed="true" do not have TT tags -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 196912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=196912&action=edit Bug 42094: Fix occurrence in t Patch from commit 817b7bc -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42330 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42330 [Bug 42330] Use main-container.inc from all the templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42332 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42332 [Bug 42332] Remove conditional TT tags from tables thead -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 --- Comment #17 from David Cook <dcook@prosentient.com.au> --- (In reply to Jonathan Druart from comment #0)
On bug 41324 we tidy all the script tags that contained a kohaTable. Now we would like to tidy all the remaining script tags.
We will certainly need a comment in the code to flag the script tag that is used to interpolate TT variables into JS variable.
``` <script> // Accept TT tags here let js_variable = [% perl_variable %]; </script>
<script> // Here TT tags are prohibided, and ideally the code must be moved to a separate .js file // And we can reuse js_variable </script> ```
The hard part here is that let 'js_variable = [% perl_variable | html %]' or 'js_variable = [% perl_variable | uri%]' can lead Javascript string content that contains inappropriately escaped characters. Say it's a search string. If you do 'js_variable = [% perl_variable | html %]' then "this & that" becomes "this & that", which is incorrect... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |BLOCKED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42330 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42330 [Bug 42330] Use main-container.inc from all the templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42748 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42748 [Bug 42748] Rewrite selenium/administration_tasks.t using Cypress -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42290, which changed state. Bug 42290 Summary: Tidy all script tags - suggestion https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42290 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42283, which changed state. Bug 42283 Summary: Tidy all script tags - cataloguing https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42283 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42282, which changed state. Bug 42282 Summary: Tidy all script tags - catalogue https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42282 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42278, which changed state. Bug 42278 Summary: Tidy all script tags - circ https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42278 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42286, which changed state. Bug 42286 Summary: Tidy all script tags - ill https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42286 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42094 Bug 42094 depends on bug 42281, which changed state. Bug 42281 Summary: Tidy all script tags - authorities https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42281 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org