Bugzilla – Attachment 121728 Details for
Bug 27378
Enable compliance with EU Cookie Legislation via cookie consent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27378: Add new 'modaljs' syspref type
Bug-27378-Add-new-modaljs-syspref-type.patch (text/plain), 5.00 KB, created by
Andrew Isherwood
on 2021-06-09 11:09:55 UTC
(
hide
)
Description:
Bug 27378: Add new 'modaljs' syspref type
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2021-06-09 11:09:55 UTC
Size:
5.00 KB
patch
obsolete
>From c6b34963bf42a992cafa1d571706175e90edc13a Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Mon, 11 Jan 2021 14:50:17 +0000 >Subject: [PATCH] Bug 27378: Add new 'modaljs' syspref type >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This commit adds a new 'modaljs' syspref type. This is similar to the existing >'modalselect' syspref type but instead of using a file to create a list of >selectable options which are displayed in the modal, it assumes that anything >can happen within the modal driven by JS, and whatever happens is going to >return a string, that will be saved as the syspref value. In our case, the >string will be all the details of the âchunksâ concatenated into a string >--- > admin/preferences.pl | 15 ++++++++++----- > koha-tmpl/intranet-tmpl/prog/css/preferences.css | 9 ++++++--- > .../prog/en/modules/admin/preferences.tt | 2 ++ > .../intranet-tmpl/prog/js/pages/preferences.js | 4 ++++ > 4 files changed, 22 insertions(+), 8 deletions(-) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index 20f9f6f4cd..f836217b51 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -63,11 +63,16 @@ sub _get_chunk { > if( $options{'syntax'} ){ > $chunk->{'syntax'} = $options{'syntax'}; > } >- >- if( $options{'type'} && $options{'type'} eq 'modalselect' ){ >- $chunk->{'source'} = $options{'source'}; >- $chunk->{'exclusions'} = $options{'exclusions'} // ""; >- $chunk->{'type'} = 'modalselect'; >+ if( $options{'type'} ) { >+ if( $options{'type'} eq 'modalselect' ){ >+ $chunk->{'source'} = $options{'source'}; >+ $chunk->{'exclusions'} = $options{'exclusions'} // ""; >+ $chunk->{'type'} = 'modalselect'; >+ } elsif( $options{'type'} eq 'modaljs' ){ >+ $chunk->{'type'} = 'modaljs'; >+ $chunk->{'initiator'} = $options{'initiator'}; >+ $chunk->{'processor'} = $options{'processor'}; >+ } > } > > if ( $options{'class'} && $options{'class'} eq 'password' ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/css/preferences.css b/koha-tmpl/intranet-tmpl/prog/css/preferences.css >index 60114036c9..35966f420c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/preferences.css >+++ b/koha-tmpl/intranet-tmpl/prog/css/preferences.css >@@ -3,7 +3,8 @@ > .preference-multi, > .preference-long, > .preference-file, >-.preference-modalselect { >+.preference-modalselect, >+.preference-modaljs { > width: 20em; > } > >@@ -15,11 +16,13 @@ > width: 5em; > } > >-input[type="text"].modalselect { >+input[type="text"].modalselect, >+input[type="text"].modaljs { > cursor: pointer; > } > >-input[type="text"].modalselect:hover { >+input[type="text"].modalselect:hover, >+input[type="text"].modaljs:hover { > background-color: #FFC; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >index 33a9d5a69c..3f13204990 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt >@@ -127,6 +127,8 @@ > </select> > [% ELSIF ( CHUNK.type_modalselect ) %] > <input type="text" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="modalselect preference preference-[% CHUNK.type | html %]" data-source="[% CHUNK.source | html %]" data-exclusions="[% CHUNK.exclusions | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/> >+ [% ELSIF ( CHUNK.type_modaljs ) %] >+ <input type="text" name="pref_[% CHUNK.name | html %]" data-initiator="[% CHUNK.initiator | html %]" data-processor="[% CHUNK.processor %]" id="pref_[% CHUNK.name | html %]" class="modaljs preference preference-[% CHUNK.type | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/> > [% ELSIF ( CHUNK.type_multiple ) %] > <select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple"> > [% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index e7d8dad01a..822b1a8c2e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -260,6 +260,10 @@ $( document ).ready( function () { > $("#prefModal").modal("show"); > }); > >+ $(".modaljs").on("click", function () { >+ console.log('modaljs clicked'); >+ }); >+ > $("#saveModalPrefs").on("click", function(){ > var formfieldid = $("#" + $(this).data("target") ); > var prefs = []; >-- >2.20.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 27378
:
115544
|
115545
|
115546
|
115547
|
115548
|
115756
|
116397
|
116398
|
116399
|
116400
|
116401
|
116402
|
116403
|
116416
|
116417
|
116418
|
116419
|
116420
|
116421
|
116422
|
116423
|
116978
|
116979
|
116980
|
116981
|
116982
|
116983
|
116984
|
116985
|
116986
|
121728
|
121729
|
121730
|
121731
|
121732
|
121733
|
121734
|
121735
|
121995
|
121996
|
121997
|
121998
|
121999
|
122000
|
122001
|
122002
|
122635
|
122636
|
122637
|
122638
|
122639
|
122640
|
122641
|
122642
|
124957
|
124958
|
124959
|
124960
|
124961
|
124962
|
124963
|
124964
|
124965
|
130072
|
130073
|
130074
|
130075
|
130076
|
130077
|
130078
|
130079
|
130080
|
135309
|
135310
|
135311
|
135312
|
135313
|
135314
|
135315
|
135316
|
135317
|
135318
|
151735
|
151736
|
151737
|
151738
|
151739
|
151740
|
151741
|
151742
|
151743
|
151744
|
151745
|
151746
|
151747
|
151748
|
151749
|
151750
|
151751
|
151752
|
151753
|
151826
|
151827
|
151828
|
151829
|
151830
|
151831
|
151832
|
151833
|
151834
|
151835
|
151836
|
151837
|
151838
|
151839
|
151840
|
151841
|
151842
|
151843
|
151844
|
153326
|
153327
|
153328
|
153329
|
153330
|
153331
|
153332
|
153333
|
153334
|
153335
|
153336
|
154015
|
154016
|
154017
|
154018
|
154019
|
154020
|
154021
|
154022
|
154023
|
154024
|
154025
|
154093
|
154264
|
154265
|
154266
|
154267
|
154268
|
154269
|
154270
|
154271
|
154272
|
154273
|
154274
|
154275
|
154276