Lines 1575-1585
Link Here
|
1575 |
[% Asset.css("lib/codemirror/highlight.css") | $raw %] |
1575 |
[% Asset.css("lib/codemirror/highlight.css") | $raw %] |
1576 |
[% Asset.js( "js/mana.js" ) | $raw %] |
1576 |
[% Asset.js( "js/mana.js" ) | $raw %] |
1577 |
[% Asset.js("js/form-submit.js") | $raw %] |
1577 |
[% Asset.js("js/form-submit.js") | $raw %] |
|
|
1578 |
[% INCLUDE 'select2.inc' %] |
1579 |
|
1578 |
<script> |
1580 |
<script> |
1579 |
|
1581 |
|
1580 |
// if the report param form has multiselects override default form submission |
1582 |
// if the report param form has multiselects override default form submission |
1581 |
if( $('#report_param_form').find('select[multiple]').length ) { |
1583 |
if( $('#report_param_form').find('select[multiple]').length ) { |
1582 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
1584 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
|
|
1585 |
$(this).prepend('<option hidden></option>'); |
1583 |
$(this).on('change', function() { |
1586 |
$(this).on('change', function() { |
1584 |
var $selected = $(this).val().join('\n'); |
1587 |
var $selected = $(this).val().join('\n'); |
1585 |
$(this).find('option:first').val($selected); |
1588 |
$(this).find('option:first').val($selected); |
Lines 1588-1593
Link Here
|
1588 |
|
1591 |
|
1589 |
$('#report_param_form').on('submit', function(e) { |
1592 |
$('#report_param_form').on('submit', function(e) { |
1590 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
1593 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
|
|
1594 |
if( $(this).find('option:selected').length ) { |
1595 |
var $selected = $('option:first', this).val(); |
1596 |
$(this).val($selected); |
1597 |
} |
1598 |
else { |
1599 |
let values = $.map( $(this).find('option'), function(o) { |
1600 |
return $(o).val(); |
1601 |
}).slice(1).join('\n'); |
1602 |
$(this).find('option:first').val(values).prop('selected', true); |
1603 |
} |
1591 |
if( $(this).find('option:selected').length === 0 ) { |
1604 |
if( $(this).find('option:selected').length === 0 ) { |
1592 |
$(this).val(['%']); |
1605 |
$(this).val(['%']); |
1593 |
} |
1606 |
} |
Lines 2309-2314
Link Here
|
2309 |
$("#limit").val( limit ); |
2322 |
$("#limit").val( limit ); |
2310 |
$("#limitselect").submit(); |
2323 |
$("#limitselect").submit(); |
2311 |
}); |
2324 |
}); |
|
|
2325 |
|
2326 |
// Apply select2 to all select fields having a "multiple" attribute |
2327 |
let selectFields = document.querySelectorAll('select[multiple]'); |
2328 |
selectFields.forEach((selectField) => { |
2329 |
selectField.style.minWidth = '320px'; |
2330 |
$(selectField).select2({ |
2331 |
closeOnSelect: false, |
2332 |
}); |
2333 |
}); |
2334 |
|
2312 |
}); |
2335 |
}); |
2313 |
|
2336 |
|
2314 |
$("#toggle_auto_links").on("click", function(e){ |
2337 |
$("#toggle_auto_links").on("click", function(e){ |
2315 |
- |
|
|