@@ -, +, @@ Customisations page. button. detail entry box and that it displays as expected. HTML customisations page. the 'CatalogConcernTemplate' block pre-filled in the details --- .../data/mysql/atomicupdate/bug_31028.pl | 33 +++++++++++++++++++ .../data/mysql/en/optional/sample_news.yml | 33 +++++++++++++++++++ .../en/modules/tools/additional-contents.tt | 2 +- .../opac-tmpl/bootstrap/css/src/opac.scss | 7 ++++ .../en/includes/modals/catalog_concern.inc | 17 +++++++++- .../bootstrap/js/modals/catalog_concern.js | 8 +++++ 6 files changed, 98 insertions(+), 2 deletions(-) --- a/installer/data/mysql/atomicupdate/bug_31028.pl +++ a/installer/data/mysql/atomicupdate/bug_31028.pl @@ -52,5 +52,38 @@ return { } ); say $out "`OpacCatalogConcerns` preference added"; + + if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernHelp') )[0] == 0 ) { # Check to make idempotent + $dbh->do( + q{ + INSERT INTO additional_contents ( category, code, location, title, content, lang, published_on, expirationdate, number ) VALUES ('html_customizations', 'CatalogConcernHelp_1', 'CatalogConcernHelp', 'Catalog concern help text', 'Please describe your concern clearly and the library will try to deal with it as quickly as possible', 'default', CAST(NOW() AS date), '2099-01-10', 1 ) + } + ); + say $out "`CatalogConcernHelp` block added to html_customization"; + } + + if ( ( $dbh->selectrow_array('SELECT COUNT(*) FROM additional_contents WHERE location=?', undef, 'CatalogConcernTemplate') )[0] == 0 ) { # Check to make idempotent + my $cc_template = <<~ 'END_TEMPLATE'; + **Describe the concern** + A clear and concise description of what the concern is. + + **To Reproduce** + Steps to reproduce the behavior: + 1. Go to '...' + 2. Click on '....' + 3. Scroll down to '....' + 4. See error + + **Expected behavior** + A clear and concise description of what you expected to happen. + END_TEMPLATE + + $dbh->do( + qq{ + INSERT INTO additional_contents ( category, code, location, title, content, lang, published_on, expirationdate, number ) VALUES ('html_customizations', 'CatalogConcernTemplate_1', 'CatalogConcernTemplate', 'Catalog concern template text', "$cc_template", 'default', CAST(NOW() AS date), '2099-01-10', 1 ) + } + ); + say $out "`CatalogConcernTemplate` block added to html_customization"; + } } } --- a/installer/data/mysql/en/optional/sample_news.yml +++ a/installer/data/mysql/en/optional/sample_news.yml @@ -55,3 +55,36 @@ tables: published_on: "2007-10-29 05:34:45" expirationdate: "2099-01-10" number: 2 + + - title: "Catalog concern help text" + category: "html_customizations" + location: "CatalogConcernHelp" + code: "CatalogConcernHelp_1" + content: + - "Please describe your concern clearly and the library will try to deal with it as quickly as possible" + lang: "default" + published_on: "2007-10-29 05:25:58" + expirationdate: "2099-01-10" + number: 1 + + - title: "Catalog concern template text" + category: "html_customizations" + location: "CatalogConcernTemplate" + code: "CatalogConcernTemplate_1" + content: + - "**Describe the concern**" + - "A clear and concise description of what the concern is." + - "" + - "**To Reproduce**" + - "Steps to reproduce the behavior:" + - "1. Go to '...'" + - "2. Click on '....'" + - "3. Scroll down to '....'" + - "4. See error" + - "" + - "**Expected behavior**" + - "A clear and concise description of what you expected to happen." + lang: "default" + published_on: "2007-10-29 05:25:58" + expirationdate: "2099-01-10" + number: 1 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -487,7 +487,7 @@ [% END %] [% END %] [% ELSE %] - [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo' ] %] + [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate' ] %] [% FOREACH l IN available_options.sort %] [% IF l == location %] --- a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss +++ a/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%; --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc @@ -1,3 +1,6 @@ +[% USE AdditionalContents %] +[% SET CatalogConcernHelp = AdditionalContents.get( location => "CatalogConcernHelp", lang => lang, library => logged_in_user.branchcode || default_branch ) %] +[% SET CatalogConcernTemplate = AdditionalContents.get( location => "CatalogConcernTemplate", lang => lang, library => logged_in_user.branchcode || default_branch ) %] --- a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js +++ a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js @@ -13,11 +13,19 @@ $(document).ready(function() { } $('#addConcernModal').on('show.bs.modal', function(e) { + // Redirect to login modal if not logged in if (logged_in_user_id === "") { $('#modalAuth').append(''); $('#loginModal').modal('show'); return false; } + + $('#addConfirm').prop('disabled', false); + let concern_body = $('#concern_body'); + if ( concern_body.val() === "" ) { + let template = $('#concern_template').text(); + concern_body.val(template); + } }); $('#addConcernModal').on('click', '#addConfirm', function(e) { --