From 7fc3ca91653aa359fe0108fb6b7d379dcf341bea 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 | 23 +++++++++++++++ 5 files changed, 69 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 14caa1bcf6..d534ecb7a5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss +++ b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss @@ -146,6 +146,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 a3cbb23590..644a578671 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 816e930e70..068de7f8bf 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..24617528ee --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js @@ -0,0 +1,23 @@ +$(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'); + }, + contentType: "json" + }); + }); +}); -- 2.20.1