Bugzilla – Attachment 146220 Details for
Bug 31028
Add 'Report a concern' feature for patrons to report concerns about catalog records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31028: Add configurable help text and templates
Bug-31028-Add-configurable-help-text-and-templates.patch (text/plain), 10.61 KB, created by
Martin Renvoize (ashimema)
on 2023-02-06 09:49:09 UTC
(
hide
)
Description:
Bug 31028: Add configurable help text and templates
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-02-06 09:49:09 UTC
Size:
10.61 KB
patch
obsolete
>From 3eaedd279bff167b4dab1bb6e8c02df6d2da8423 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 25 Oct 2022 13:40:32 +0100 >Subject: [PATCH] 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> >--- > .../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 | 18 +++++++++- > .../bootstrap/js/modals/catalog_concern.js | 8 +++++ > 6 files changed, 99 insertions(+), 2 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_31028.pl b/installer/data/mysql/atomicupdate/bug_31028.pl >index 2b5204c6922..459eaeb99fe 100644 >--- a/installer/data/mysql/atomicupdate/bug_31028.pl >+++ b/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"; >+ } > } > } >diff --git a/installer/data/mysql/en/optional/sample_news.yml b/installer/data/mysql/en/optional/sample_news.yml >index 7023d8c02a0..db10ad18e9d 100644 >--- a/installer/data/mysql/en/optional/sample_news.yml >+++ b/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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index 04fdba73b9b..69076922aef 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -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> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss b/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss >index 8af3afa2ed7..1641ce434d0 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 >index 6d6de1041e4..cd9bf7b533c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/modals/catalog_concern.inc >@@ -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> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js b/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js >index c5d264a84f4..f5dab6aa132 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/modals/catalog_concern.js >+++ b/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('<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) { >-- >2.39.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31028
:
137412
|
139222
|
139223
|
139224
|
139225
|
139226
|
139227
|
139228
|
139229
|
139230
|
139231
|
139232
|
139233
|
139234
|
139235
|
139236
|
139237
|
139238
|
139572
|
139573
|
139574
|
139575
|
139576
|
139577
|
139578
|
139579
|
139580
|
139581
|
139582
|
139583
|
139584
|
139585
|
139586
|
139587
|
139588
|
139589
|
139590
|
139591
|
140289
|
140290
|
140291
|
140292
|
140293
|
140294
|
140295
|
140296
|
140297
|
140298
|
140299
|
140300
|
140301
|
140302
|
140303
|
140304
|
140305
|
140306
|
140307
|
140308
|
140436
|
140437
|
140438
|
140439
|
140440
|
140441
|
140442
|
140443
|
140444
|
140445
|
140446
|
140447
|
140448
|
140449
|
140450
|
140451
|
140452
|
140453
|
140454
|
140455
|
140764
|
140765
|
140766
|
140767
|
140768
|
140769
|
140770
|
140771
|
140772
|
140773
|
140774
|
140775
|
140776
|
140777
|
140778
|
140779
|
140780
|
140781
|
140782
|
140783
|
140793
|
140929
|
140930
|
140931
|
140932
|
140933
|
140934
|
140935
|
140936
|
140937
|
140938
|
140939
|
140940
|
140941
|
140942
|
140943
|
140944
|
140945
|
140946
|
140947
|
140948
|
140949
|
140950
|
141133
|
141134
|
141135
|
141136
|
141137
|
141138
|
141139
|
141140
|
141141
|
141142
|
141143
|
141144
|
141145
|
141146
|
141147
|
141148
|
141149
|
141150
|
141151
|
141152
|
141153
|
141154
|
141440
|
141441
|
141442
|
141443
|
141444
|
141445
|
141446
|
141447
|
141448
|
141449
|
141450
|
141451
|
141452
|
141453
|
141454
|
141455
|
141456
|
141457
|
141458
|
141459
|
141460
|
142164
|
142165
|
142166
|
142167
|
142168
|
142169
|
142170
|
142171
|
142172
|
142173
|
142174
|
142175
|
142177
|
142179
|
142180
|
142181
|
142182
|
142183
|
142184
|
142185
|
142186
|
142187
|
142188
|
142189
|
142190
|
142191
|
142616
|
142617
|
142618
|
142619
|
142620
|
142621
|
142622
|
142623
|
142624
|
142625
|
142626
|
142627
|
142932
|
142933
|
142934
|
142935
|
142936
|
142937
|
142938
|
142939
|
142940
|
142941
|
142942
|
142943
|
142944
|
142945
|
142946
|
142947
|
142948
|
142949
|
143238
|
143239
|
143240
|
143241
|
143242
|
143243
|
143244
|
143245
|
143246
|
143247
|
143248
|
143249
|
143250
|
143251
|
143252
|
143253
|
143254
|
143255
|
143256
|
143257
|
143302
|
143303
|
143304
|
143305
|
143306
|
143307
|
143308
|
143309
|
143310
|
143311
|
143312
|
143313
|
143314
|
143315
|
143316
|
143317
|
143318
|
143319
|
143320
|
143321
|
143322
|
143323
|
143324
|
143325
|
143326
|
143327
|
143328
|
143329
|
143330
|
143331
|
143332
|
143333
|
143334
|
143335
|
143336
|
143337
|
143338
|
143339
|
143340
|
143341
|
143470
|
143471
|
143472
|
143473
|
143474
|
143475
|
143476
|
143477
|
143478
|
143479
|
143480
|
143481
|
143482
|
143483
|
143484
|
143485
|
143486
|
143487
|
143488
|
143489
|
143490
|
143647
|
143648
|
143649
|
143650
|
143651
|
143652
|
143653
|
143654
|
143655
|
143656
|
143657
|
143658
|
143659
|
143660
|
143661
|
143662
|
143663
|
143664
|
143665
|
143666
|
143667
|
143708
|
143709
|
143710
|
143711
|
143712
|
143713
|
143714
|
143715
|
143716
|
143717
|
143718
|
143719
|
143720
|
143721
|
143722
|
143723
|
143724
|
143725
|
143726
|
143727
|
144647
|
144648
|
144649
|
144650
|
144651
|
144652
|
144653
|
144654
|
144655
|
144656
|
144657
|
144658
|
144659
|
144660
|
144661
|
144662
|
144663
|
144664
|
144665
|
144666
|
144667
|
144668
|
145542
|
146214
|
146215
|
146216
|
146217
|
146218
|
146219
|
146220
|
146221
|
146222
|
146223
|
146224
|
146225
|
146226
|
146227
|
146228
|
146229
|
146230
|
146231
|
146232
|
146233
|
146234
|
146235
|
146236
|
146237
|
146238
|
146239
|
146240
|
146241
|
146242
|
146243
|
146244
|
146245
|
146246
|
146247
|
146248
|
146249
|
146250
|
146251
|
146252
|
146253
|
146254
|
146255
|
146256
|
146257
|
146258
|
146259
|
146260
|
146261
|
146262
|
146697
|
146870
|
146871
|
146872
|
146873
|
146874
|
146875
|
146876
|
146877
|
146878
|
146879
|
146880
|
146881
|
146882
|
146883
|
146884
|
146885
|
146886
|
146887
|
146888
|
146889
|
146890
|
146891
|
146892
|
146893
|
146894
|
146895
|
146896
|
147797
|
147840
|
147841
|
147844
|
147859
|
147860
|
147861
|
147866
|
148673
|
149931