From aa23fef94d42faf7faf30e44a112546bb90a8a2e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 7 Jul 2022 11:32:13 +0100 Subject: [PATCH] Bug 31028: Add 'Report a concern' to OPAC details This patch adds a new 'Report a concern' option to the right sidebar on the opac detail page. On clicking the link, a modal will display allowing the user to enter a short message regarding their concerns and then submission will record said message. --- .../opac-tmpl/bootstrap/css/src/opac.scss | 7 +++++ .../en/includes/modals/catalog_concern.inc | 28 +++++++++++++++++++ .../en/includes/opac-detail-sidebar.inc | 4 +++ .../bootstrap/en/modules/opac-detail.tt | 7 +++++ .../bootstrap/js/modals/catalog_concern.js | 24 ++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss index 63434d3cbf..e101328bf7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss +++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss @@ -147,6 +147,13 @@ textarea { width: 50%; } +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 10px; + color: #737373; +} + legend { color: #727272; font-size: 110%; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc new file mode 100644 index 0000000000..5b0ff09627 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc @@ -0,0 +1,28 @@ + + diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc index 2602ad7502..a0b0cd1ac2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc @@ -42,6 +42,10 @@
  • Suggest for purchase
  • [% END %] + [% IF Koha.Preference('OpacCatalogConcerns') %] +
  • Report a concern
  • + [% END %] + [% IF ( OpacHighlightedWords && query_desc ) %]
  • Unhighlight diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 954c1445cd..2f0b90e935 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1434,7 +1434,14 @@ +[% IF Koha.Preference('OpacCatalogConcerns') %] + [% INCLUDE 'modals/catalog_concern.inc' %] +[% END %] + [% BLOCK jsinclude %] + [% IF Koha.Preference('OpacCatalogConcerns') %] + [% Asset.js("js/modals/catalog_concern.js") | $raw %] + [% END %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] [% INCLUDE greybox.inc %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js b/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js new file mode 100644 index 0000000000..5ae7bc1269 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js @@ -0,0 +1,24 @@ +$(document).ready(function() { + $('#addConcernModal').on('click', '#addConfirm', function(e) { + let reporter_id = $('#reporter_add').val(); + let biblio_id = $('#biblio_add').val(); + let message = $('#message_add').val(); + + params = { + message: message, + biblio_id: biblio_id, + reporter_id: reporter_id, + }; + + $.ajax({ + url: '/api/v1/public/catalog/concerns', + type: 'POST', + data: JSON.stringify(params), + success: function(data) { + $('#addConcernModal').modal('hide'); + $('#message_add').val(''); + }, + contentType: "json" + }); + }); +}); -- 2.20.1