Bug 31028: Add configurable help text and templates
This patch adds configurable help text and a template option to the catalog concern report modal in the OPAC. Test plan 1) Enable `OpacCatalogConcerns` preference 2) Build the CSS for the OPAC 3) Check that there is a 'CatalogConcernHelp' block listed in the HTML Customisations page. 4) On the OPAC navigate to a record and click the 'Report a concern' button. 5) Confirm that the content of 'CatalogConcernHelp' displays beneath the detail entry box and that it displays as expected. 6) Check that there is a 'CatalogConcernTemplate' block listed in the HTML customisations page. 7) On the OPAC 'Report a concern' modal, you should see the content of the 'CatalogConcernTemplate' block pre-filled in the details textarea. Note: There is a caveat to the template.. as textarea can only be used to submit plaintext with this patch and as such the template needs to not utilise the WYSIWYG editor else you will be faced with raw HTML inside your textarea. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Helen Oliver <HOliver@tavi-port.ac.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
015004d418
commit
086f2b0100
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -493,7 +493,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 %]
|
||||
<option value="[% l | html %]" selected="selected">[% l | html %]</option>
|
||||
|
|
|
|||
|
|
@ -148,6 +148,13 @@ textarea {
|
|||
width: 50%;
|
||||
}
|
||||
|
||||
.help-block {
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 10px;
|
||||
color: #737373;
|
||||
}
|
||||
|
||||
legend {
|
||||
color: #727272;
|
||||
font-size: 110%;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
[% USE raw %]
|
||||
[% 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 ) %]
|
||||
<!-- Add concern modal -->
|
||||
<div class="modal" id="addConcernModal" tabindex="-1" role="dialog" aria-labelledby="addConcernModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
|
|
@ -16,7 +20,19 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="concern_body">Please describe your concerns: </label>
|
||||
<textarea class="form-control" name="concern_body" id="concern_body" required="required" rows="15"></textarea>
|
||||
<textarea class="form-control" name="concern_body" id="concern_body" aria-describedby="helpBlock" required="required" rows="15"></textarea>
|
||||
[%- IF CatalogConcernHelp && CatalogConcernHelp.content && CatalogConcernHelp.content.count > 0 -%]
|
||||
[%- FOREACH help IN CatalogConcernHelp.content -%]
|
||||
<p id="helpBlock" class="help-block">[%- help.content | $raw -%]</p>
|
||||
[%- END -%]
|
||||
[%- END -%]
|
||||
<div id="concern_template" style="display: none;">
|
||||
[%- IF CatalogConcernTemplate && CatalogConcernTemplate.content && CatalogConcernTemplate.content.count > 0 -%]
|
||||
[%- FOREACH template IN CatalogConcernTemplate.content -%]
|
||||
[%- template.content | $raw -%]
|
||||
[%- END -%]
|
||||
[%- END -%]
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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('<input type="hidden" name="return" value="' + window.location.pathname + window.location.search + '&modal=concern" />');
|
||||
$('#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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue