Summary: | Detail page missing Javascript accessible biblionumber value | ||
---|---|---|---|
Product: | Koha | Reporter: | David Cook <dcook> |
Component: | OPAC | Assignee: | David Cook <dcook> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | andrew, caroline.cyr-la-rose, fridolin.somers, koha, m.de.rooy, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26890 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
21.05.00,20.11.03,20.05.09
|
|
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 28021 | ||
Attachments: |
Bug 27029: Add data-biblionumber attribute to OPAC detail page
Bug 27029: Add data-biblionumber attribute to OPAC detail page Bug 27029: Add data-biblionumber attribute to OPAC detail page Bug 27029: (QA follow-up) Adding html filter Bug 27029: Add a selenium regression test |
Description
David Cook
2020-11-16 00:11:38 UTC
Ok maybe not body as that would involve updating bodytag.inc, which is too far reaching. div#catalogue_detail_biblio would work though as follows: <div id="catalogue_detail_biblio" class="maincontent" data-biblionumber="29"> Looks like the schema.org is partially in the XSLT and partially in opac-detail.tt so that's... no. (In reply to David Cook from comment #1) > <div id="catalogue_detail_biblio" class="maincontent" data-biblionumber="29"> > Then you can grab the biblionumber as easily as doing the following: document.querySelector("div#catalogue_detail_biblio").dataset.biblionumber; Or jquery: $("div#catalogue_detail_biblio").attr("data-biblionumber"); $("div#catalogue_detail_biblio").data("biblionumber"); Created attachment 113648 [details] [review] Bug 27029: Add data-biblionumber attribute to OPAC detail page This patch adds a data-biblionumber attribute to the div#catalogue_detail_biblio elements on opac-detail.pl, so that Javascript running on the page can easily fetch and use the record's biblionumber. Note that this would be useful for Koha plugins or any OPACUserJS which wants to add functionality onto the OPAC detail page. Adding myself as Assignee, but still curious what Owen Leonard thinks. Thx for the quick uptake on my idea/wish I'll look into it, I'll try to make it today I tested this fix, what is the process to sign it off? (In reply to Mark Hofstetter from comment #7) > I tested this fix, what is the process to sign it off? Thanks, Mark. You should be able to find everything you need here: https://wiki.koha-community.org/wiki/Git_bz_configuration#Signing_off Since you've already marked it as Signed Off on Bugzilla, it basically boils down to adding a "Signed-off-by: Mark Hofstetter <koha@trust-box.at>" to the bottom of my patch and re-uploading to replace my original patch. Created attachment 113705 [details] [review] Bug 27029: Add data-biblionumber attribute to OPAC detail page This patch adds a data-biblionumber attribute to the div#catalogue_detail_biblio elements on opac-detail.pl, so that Javascript running on the page can easily fetch and use the record's biblionumber. Signed-off-by: Mark Hofstetter <mark@hofstetter.at>, <koha@trust-box.at> Perfect, Mark! If you go to https://dashboard.koha-community.org/, you'll also see that your name now appears in the list of sign offs as well. until the patch is in core you may use // "if" statment may/has to be removed when // https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27029 // is in koha var biblionumber = $("div#catalogue_detail_biblio").data("biblionumber"); if (!biblionumber) { var x = document.getElementsByClassName("unapi-id")[0] .getAttribute("title"); biblionumber = x.split(':')[2]; } see https://github.com/HKS3/koha-plugin-subordinate-items/ Created attachment 115675 [details] [review] Bug 27029: Add data-biblionumber attribute to OPAC detail page This patch adds a data-biblionumber attribute to the div#catalogue_detail_biblio elements on opac-detail.pl, so that Javascript running on the page can easily fetch and use the record's biblionumber. Signed-off-by: Mark Hofstetter <mark@hofstetter.at>, <koha@trust-box.at> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 115676 [details] [review] Bug 27029: (QA follow-up) Adding html filter Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 115862 [details] [review] Bug 27029: Add a selenium regression test Pushed to master for 21.05, thanks to everybody involved! Nice small enhancement, I choose to backport. Pushed to 20.11.x for 20.11.03 Agreed, this seems small and handy. Pushed t0 20.05.x for 20.05.09 Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed. |