Now that we can translate strings in JavaScript we can convert authorities_js.inc into a JavaScript file with language strings updated with the new JS translation function.
Created attachment 178537 [details] [review] Bug 25318: Convert authorities_js.inc to JavaScript file This patch creates a new JavaScript file, authorities.js, and includes it on pages which previously used authorities_js.inc. Some minor changes to the JavaScript have been made in order to pass JS variables instead of template variables. To test, apply the patch and go to Authorities. - Perform a search for authorities and test various features on the search result page:: - New from Z39.50/SRU - Actions -> Merge - Actions -> Delete - Action -> MARC preview - View the detail page for an authority record and test: - New from Z39.50/SRU - Edit -> Replace record via Z39.50/SRU - Edit -> Delete record - Go to Cataloging and create a new record. - Go to tab 1 and click the plugin trigger link on 100a. - Confirm that the authority search popup appears and works to add a selected author. Sponsored-by: Athens County Public Libraries
Merging throws "Uncaught ReferenceError: searchType is not defined." Since it's exactly what we were doing before (with the extra step of getting "" from [% marclist | html %] without a marclist), sticking a 'const searchType = "";' in merge.tt seems like the poetic fix.
Created attachment 179299 [details] [review] Bug 25318: Convert authorities_js.inc to JavaScript file This patch creates a new JavaScript file, authorities.js, and includes it on pages which previously used authorities_js.inc. Some minor changes to the JavaScript have been made in order to pass JS variables instead of template variables. To test, apply the patch and go to Authorities. - Perform a search for authorities and test various features on the search result page:: - New from Z39.50/SRU - Actions -> Merge - Actions -> Delete - Action -> MARC preview - View the detail page for an authority record and test: - New from Z39.50/SRU - Edit -> Replace record via Z39.50/SRU - Edit -> Delete record - Go to Cataloging and create a new record. - Go to tab 1 and click the plugin trigger link on 100a. - Confirm that the authority search popup appears and works to add a selected author. Sponsored-by: Athens County Public Libraries Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Created attachment 179300 [details] [review] Bug 25318: (follow-up) Make searchType be defined in merge.tt With authorities_js.inc doing "var searchType = '[% marclist | html %]';" in merge.tt where marclist isn't defined we got "var searchType = '';". This patch just adds 'const searchType = ""' directly to merge.tt to avoid a JavaScript console error. Test plan: 1. Open the devtools console 2. Do an authority search that returns at least two authorities 3. Select one, then another for merge 4. When the merge.pl page loads, observe an "Uncaught ReferenceError" in the console 5. Apply followup, repeat steps 1-3, without an "Uncaught ReferenceError"