Bug 34180 - Template variable in JavaScript triggers error when showing authority MARC preview
Summary: Template variable in JavaScript triggers error when showing authority MARC pr...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-30 19:59 UTC by Owen Leonard
Modified: 2023-12-28 20:47 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.02,22.11.08


Attachments
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying (2.55 KB, patch)
2023-06-30 20:10 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying (2.60 KB, patch)
2023-06-30 20:34 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying (2.67 KB, patch)
2023-07-03 14:00 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2023-06-30 19:59:06 UTC
authorities-detail-modal.js has template variables in it:

<img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" />

We need to define variables in a Template Toolkit-processed file.
Comment 1 Owen Leonard 2023-06-30 20:10:58 UTC
Created attachment 152918 [details] [review]
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying

Since template variables cannot be processed by JS, we must use a
template to declare a JS variable which the JS file can used. This patch
corrects this problem in the JS file which handles display of the
authority MARC preview from the authority search results page.

To test, apply the patch and go to Authorities.

- Perform a search which will return multiple authority results.
- Click "Actions -> MARC preview." The preview should display correctly.
- Click "Actions -> MARC preview" on another search result. This preview
  should also look correct.
- There should be no JavaScript errors in the browser console.
Comment 2 Phil Ringnalda 2023-06-30 20:34:33 UTC
Created attachment 152919 [details] [review]
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying

Since template variables cannot be processed by JS, we must use a
template to declare a JS variable which the JS file can used. This patch
corrects this problem in the JS file which handles display of the
authority MARC preview from the authority search results page.

To test, apply the patch and go to Authorities.

- Perform a search which will return multiple authority results.
- Click "Actions -> MARC preview." The preview should display correctly.
- Click "Actions -> MARC preview" on another search result. This preview
  should also look correct.
- There should be no JavaScript errors in the browser console.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 3 Martin Renvoize 2023-07-03 14:00:51 UTC
Created attachment 152979 [details] [review]
Bug 34180: Template variable in JavaScript prevents authority MARC preview from displaying

Since template variables cannot be processed by JS, we must use a
template to declare a JS variable which the JS file can used. This patch
corrects this problem in the JS file which handles display of the
authority MARC preview from the authority search results page.

To test, apply the patch and go to Authorities.

- Perform a search which will return multiple authority results.
- Click "Actions -> MARC preview." The preview should display correctly.
- Click "Actions -> MARC preview" on another search result. This preview
  should also look correct.
- There should be no JavaScript errors in the browser console.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2023-07-03 14:01:18 UTC
Trivial patch, resolves the issue.. no regressions spotted.

Passing QA
Comment 5 Tomás Cohen Arazi 2023-07-03 17:51:21 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Martin Renvoize 2023-07-17 15:35:58 UTC
Thanks for all the hard work!

Pushed to 23.05.x for the next release
Comment 7 Matt Blenkinsop 2023-07-18 13:28:27 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x