[Bug 20538] New: Remove the need of writing [% KOHA_VERSION %] everywhere
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Bug ID: 20538 Summary: Remove the need of writing [% KOHA_VERSION %] everywhere Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: ASSIGNED Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: julian.maurice@biblibre.com Reporter: julian.maurice@biblibre.com QA Contact: testopia@bugs.koha-community.org Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 73791 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73791&action=edit Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious This patch: - adds a Template::Toolkit plugin that generates <script> and <link> tags for JS and CSS files, and inserts automatically the Koha version in the filename - use the new plugin to remove all occurences of [% KOHA_VERSION %] - remove the code that was adding KOHA_VERSION as a template variable Test plan: 1. Apply patch 2. Go to several different pages in Koha (opac and intranet) while checking your browser's dev tools (there should be no 404 for JS and CSS files, and the Koha version should appear in filenames) and the server logs (there should be no "File not found") 3. `git grep KOHA_VERSION` should return nothing 4. prove t/db_dependent/Koha/Template/Plugin/Asset.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Julian Maurice <julian.maurice@biblibre.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=20538 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Keywords| |rel_18_05_candidate, | |RM_priority -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Roch D'Amour <roch.damour@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |roch.damour@inlibro.com Status|Needs Signoff |Patch doesn't apply --- Comment #2 from Roch D'Amour <roch.damour@inlibro.com> --- Patch doesn't apply for me on master, sorry -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73791|0 |1 is obsolete| | --- Comment #3 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 73836 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=73836&action=edit Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious This patch: - adds a Template::Toolkit plugin that generates <script> and <link> tags for JS and CSS files, and inserts automatically the Koha version in the filename - use the new plugin to remove all occurences of [% KOHA_VERSION %] - remove the code that was adding KOHA_VERSION as a template variable Test plan: 1. Apply patch 2. Go to several different pages in Koha (opac and intranet) while checking your browser's dev tools (there should be no 404 for JS and CSS files, and the Koha version should appear in filenames) and the server logs (there should be no "File not found") 3. `git grep KOHA_VERSION` should return nothing 4. prove t/db_dependent/Koha/Template/Plugin/Asset.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff --- Comment #4 from Julian Maurice <julian.maurice@biblibre.com> --- Patch rebased on master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #5 from Julian Maurice <julian.maurice@biblibre.com> --- Just in case, the sed commands I used to modify (almost) all templates: sed -i -E 's/<(script|link) .*(href|src)=["'"'"']((\[%.*?%\])\/)*([^%]*)_\[% KOHA_VERSION %\]\.(js|css)["'"'"'].*(\/?>|<\/\1>)/[% Asset.\6("\5\.\6") %]/' **/*.inc **/*.tt git status --porcelain | grep '^ M' | awk '{print $2}' | xargs -- sed -i '1i[% USE Asset %]' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |josef.moravec@gmail.com |y.org | CC| |josef.moravec@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|josef.moravec@gmail.com |testopia@bugs.koha-communit | |y.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Josef Moravec <josef.moravec@gmail.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=20538 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #73836|0 |1 is obsolete| | --- Comment #6 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 74048 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74048&action=edit Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious This patch: - adds a Template::Toolkit plugin that generates <script> and <link> tags for JS and CSS files, and inserts automatically the Koha version in the filename - use the new plugin to remove all occurences of [% KOHA_VERSION %] - remove the code that was adding KOHA_VERSION as a template variable Test plan: 1. Apply patch 2. Go to several different pages in Koha (opac and intranet) while checking your browser's dev tools (there should be no 404 for JS and CSS files, and the Koha version should appear in filenames) and the server logs (there should be no "File not found") 3. `git grep KOHA_VERSION` should return nothing 4. prove t/db_dependent/Koha/Template/Plugin/Asset.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #7 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 74049 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74049&action=edit Bug 20538: (follow-up) Update discharges request page with Asset plugin This is follow-up of bug 20524 Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #8 from Josef Moravec <josef.moravec@gmail.com> --- I started to write a rule for coding guidelines here: https://wiki.koha-community.org/wiki/Coding_Guidelines#HTML8:_use_Asset_TT_p... feel free to update it and we can discuss it on the next meeting -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA CC| |katrin.fischer@bsz-bw.de QA Contact|testopia@bugs.koha-communit |katrin.fischer@bsz-bw.de |y.org | --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- There are some FAILs in the QA script, but I assume they are just side effects/false positives for this patch. Maybe something to look into later: FAIL koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-MARCdetail.tt FAIL forbidden patterns forbidden pattern: opac-tmpl should certainly replaced with [% interface %] (line 67) OK git manipulation OK spelling OK tt_valid OK valid_template FAIL koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt FAIL forbidden patterns forbidden pattern: opac-tmpl should certainly replaced with [% interface %] (line 132) OK git manipulation OK spelling OK tt_valid OK valid_template ... 1) Is the copyright statement correct? +package Koha::Template::Plugin::Asset; + +# Copyright Marc Véron / marc veron ag, Switzerland 2) Not blocker, but a note: Need to update qa tools! Can you quickly check 1) please? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #10 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 74053 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74053&action=edit Bug 20538: Fix copyright notice in Asset.pm -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #11 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 74054 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74054&action=edit Bug 20538: Fix 2 JS paths -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #12 from Julian Maurice <julian.maurice@biblibre.com> --- (In reply to Katrin Fischer from comment #9)
There are some FAILs in the QA script, but I assume they are just side effects/false positives for this patch. Maybe something to look into later:
FAIL koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-MARCdetail.tt FAIL forbidden patterns forbidden pattern: opac-tmpl should certainly replaced with [% interface %] (line 67) OK git manipulation OK spelling OK tt_valid OK valid_template
FAIL koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth-detail.tt FAIL forbidden patterns forbidden pattern: opac-tmpl should certainly replaced with [% interface %] (line 132) OK git manipulation OK spelling OK tt_valid OK valid_template ... These ones are true positives. Fixed in the last patch
1) Is the copyright statement correct? +package Koha::Template::Plugin::Asset; + +# Copyright Marc Véron / marc veron ag, Switzerland
2) Not blocker, but a note: Need to update qa tools!
Can you quickly check 1) please?
Done. Thanks for catching that. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #13 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 74056 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74056&action=edit Bug 20538: Move categories.js out of language directory This was the last js/css file inside a language directory -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #14 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 74057 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74057&action=edit Bug 20538: Add POD for Asset.pm -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #15 from Julian Maurice <julian.maurice@biblibre.com> --- I wrote a little patch for qa-test-tools to avoid all the 'File not found' warnings. You can found it here : https://github.com/jajm/koha-qa-test-tools/tree/bug_20538 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74048|0 |1 is obsolete| | --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74058 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74058&action=edit Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere Having to write [% KOHA_VERSION %] for each url is bad because: - It's easily forgettable when adding new <script> or <link> - It prevents grep'ing for the full filename - It violates the DRY principle - If at some point we want to change the "force js and css reload" mechanism, it will be tedious This patch: - adds a Template::Toolkit plugin that generates <script> and <link> tags for JS and CSS files, and inserts automatically the Koha version in the filename - use the new plugin to remove all occurences of [% KOHA_VERSION %] - remove the code that was adding KOHA_VERSION as a template variable Test plan: 1. Apply patch 2. Go to several different pages in Koha (opac and intranet) while checking your browser's dev tools (there should be no 404 for JS and CSS files, and the Koha version should appear in filenames) and the server logs (there should be no "File not found") 3. `git grep KOHA_VERSION` should return nothing 4. prove t/db_dependent/Koha/Template/Plugin/Asset.t Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74049|0 |1 is obsolete| | --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74059&action=edit Bug 20538: (follow-up) Update discharges request page with Asset plugin This is follow-up of bug 20524 Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74053|0 |1 is obsolete| | --- Comment #18 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74060 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74060&action=edit Bug 20538: Fix copyright notice in Asset.pm Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74054|0 |1 is obsolete| | --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74061 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74061&action=edit Bug 20538: Fix 2 JS paths Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74056|0 |1 is obsolete| | --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74062 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74062&action=edit Bug 20538: Move categories.js out of language directory This was the last js/css file inside a language directory Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #74057|0 |1 is obsolete| | --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 74063 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74063&action=edit Bug 20538: Add POD for Asset.pm Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Katrin Fischer <katrin.fischer@bsz-bw.de> 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=20538 --- Comment #22 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 74171 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74171&action=edit Bug 20538: ->tag is private - tell it explicitly -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #23 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 18.05, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_18_05_candidate, |additional_work_needed |RM_priority | --- Comment #24 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Could you take a look at xt/author/valid-templates.t ? There are too many errors: File not found : lib/emoji-picker/js/emoji-picker.js at /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83. File not found : js/basket.js at /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83. File not found : js/tags.js at /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83. File not found : js/datatables.js at /home/vagrant/kohaclone/Koha/Template/Plugin/Asset.pm line 83. [...] -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #25 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 74835 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=74835&action=edit Bug 20538: Prevent warnings in xt/author/valid-templates.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 --- Comment #26 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Julian Maurice from comment #25)
Created attachment 74835 [details] [review] Bug 20538: Prevent warnings in xt/author/valid-templates.t
Pushed to master, thanks Julian! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com Resolution|--- |FIXED Status|Pushed to Master |RESOLVED --- Comment #27 from Nick Clemens <nick@bywatersolutions.com> --- Enhancement, not backported for 17.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20761 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20761 [Bug 20761] Advanced Cataloging Editor - Rancor - Some js files are not fetched using Asset -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |indradg@l2c2.co.in --- Comment #28 from M. Tompsett <mtompset@hotmail.com> --- *** Bug 20066 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20538 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |21583 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21583 [Bug 21583] Novelist Select staff client not working in staff client - ns2init.js not loading -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org