From e5d66eda4402df17b51d75a1fb5febc97157cf21 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 24 Jan 2023 12:22:34 +0000 Subject: [PATCH] Bug 32711: Add biblio details to modal This patch adds biblio details to the self-checkout modal. As part of this we add 'biblio' to the x-koha-embed option on the public items endpoint, clone the js-biblio-format include from the staff client adapting it slightly for OPAC use along the way and also import escape_str and escapeHtml from staff to opac too. --- api/v1/swagger/paths/items.yaml | 30 +++++++-- .../en/includes/js-biblio-format.inc | 64 +++++++++++++++++++ .../bootstrap/en/includes/modals/checkout.inc | 4 +- .../bootstrap/en/includes/opac-bottom.inc | 1 + koha-tmpl/opac-tmpl/bootstrap/js/global.js | 14 ++++ .../opac-tmpl/bootstrap/js/modals/checkout.js | 23 +++++-- 6 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/js-biblio-format.inc diff --git a/api/v1/swagger/paths/items.yaml b/api/v1/swagger/paths/items.yaml index 7b6017acfb7..12df48fe487 100644 --- a/api/v1/swagger/paths/items.yaml +++ b/api/v1/swagger/paths/items.yaml @@ -169,6 +169,20 @@ - $ref: "../swagger.yaml#/parameters/q_param" - $ref: "../swagger.yaml#/parameters/q_body" - $ref: "../swagger.yaml#/parameters/q_header" + - name: x-koha-embed + in: header + required: false + description: Embed list sent as a request header + type: array + items: + type: string + enum: + - biblio + - checkout + - return_claims + - return_claim + - return_claim.patron + collectionFormat: csv consumes: - application/json produces: @@ -199,12 +213,6 @@ x-koha-authorization: permissions: catalogue: "1" - x-koha-embed: - - biblio - - checkout - - return_claims - - return_claim - - return_claim.patron "/items/{item_id}/bundled_items/{bundled_item_id}": delete: x-mojo-to: Items#remove_from_bundle @@ -337,6 +345,16 @@ - $ref: "../swagger.yaml#/parameters/q_body" - $ref: "../swagger.yaml#/parameters/q_header" - $ref: "../swagger.yaml#/parameters/request_id_header" + - name: x-koha-embed + in: header + required: false + description: Embed list sent as a request header + type: array + items: + type: string + enum: + - biblio + collectionFormat: csv consumes: - application/json produces: diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-biblio-format.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-biblio-format.inc new file mode 100644 index 00000000000..77c2fe5c183 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/js-biblio-format.inc @@ -0,0 +1,64 @@ + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/checkout.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/checkout.inc index 6a19e717de8..615345ef77f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/checkout.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/checkout.inc @@ -19,6 +19,8 @@ Barcode + Title + Call number Due date @@ -26,7 +28,7 @@ - items checked out + items checked out diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index 187f8e612df..260a8f63bd3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -296,6 +296,7 @@ $(document).ready(function() { }); [% INCLUDE 'js-date-format.inc' %] +[% INCLUDE 'js-biblio-format.inc' %] [% PROCESS jsinclude %] [% IF ( Koha.Preference('OPACUserJS') ) %]