Bug 27634: Add the ability to exclude fields from "modal" sysprefs

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2021-02-05 11:08:37 +01:00 committed by Tomas Cohen Arazi
parent 931d39a197
commit 461cd34698
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
3 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,7 @@ sub _get_chunk {
if ( $options{'type'} eq 'modalselect' ) {
$chunk->{'source'} = $options{'source'};
$chunk->{'exclusions'} = $options{'exclusions'} // "";
$chunk->{'inclusions'} = $options{'inclusions'} // "";
$chunk->{'required'} = $options{'required'} // "";
$chunk->{'type'} = 'modalselect';
} elsif ( $options{'type'} eq 'modaljs' ) {

View File

@ -134,7 +134,7 @@
[% END %]
</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-required="[% CHUNK.required | html %]" data-exclusions="[% CHUNK.exclusions | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/>
<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-required="[% CHUNK.required | html %]" data-exclusions="[% CHUNK.exclusions | html %]" data-inclusions="[% CHUNK.inclusions | 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 | html %]" id="pref_[% CHUNK.name | html %]" class="modaljs preference preference-[% CHUNK.type | html %]" readonly="readonly" value="[% CHUNK.value | html %]"/>
[% ELSIF ( CHUNK.type_multiple ) %]

View File

@ -281,6 +281,7 @@ $( document ).ready( function () {
$(".modalselect").on("click", function(){
var datasource = $(this).data("source");
var exclusions = $(this).data("exclusions").split('|');
var inclusions = $(this).data("inclusions").split('|');
var required = $(this).data("required").split('|');
var pref_name = this.id.replace(/pref_/, '');
var pref_value = this.value;
@ -305,10 +306,15 @@ $( document ).ready( function () {
style = "disabled";
disabled = ' disabled="disabled" ';
checked = "";
} else if( inclusions.indexOf( key ) >= 0 ){
style = "disabled";
disabled = ' disabled="disabled" ';
checked = ' checked="checked" ';
} else {
style = "";
disabled = "";
}
items.push('<label class="' + style +'"><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + disabled + ' name="pref" value="' + key + '" /> ' + data[key]+ ' (' + key + ')</label>');
});
$("<div/>", {