View | Details | Raw Unified | Return to bug 37050
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/css/select2.css (+5 lines)
Lines 44-46 Link Here
44
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
44
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
45
    margin-right: 3px;
45
    margin-right: 3px;
46
}
46
}
47
48
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
49
    clear: none;
50
    width: auto;
51
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt (-14 / +18 lines)
Lines 882-888 Link Here
882
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
882
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
883
                                                [% IF (sql_param.select_multiple) %]
883
                                                [% IF (sql_param.select_multiple) %]
884
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
884
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
885
                                                        <option value="%" hidden></option>
885
                                                        <option value="[% sql_param.input.values.join("\n") | html %]" disabled="disabled"></option>
886
                                                [% ELSE %]
886
                                                [% ELSE %]
887
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
887
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
888
                                                [% END %]
888
                                                [% END %]
Lines 1576-1600 Link Here
1576
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1576
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1577
    [% Asset.js( "js/mana.js" ) | $raw %]
1577
    [% Asset.js( "js/mana.js" ) | $raw %]
1578
    [% Asset.js("js/form-submit.js") | $raw %]
1578
    [% Asset.js("js/form-submit.js") | $raw %]
1579
    [% INCLUDE 'select2.inc' %]
1579
    <script>
1580
    <script>
1580
1581
1581
        //  if the report param form has multiselects override default form submission
1582
        //  if the report param form has multiselects override default form submission
1582
        if( $('#report_param_form').find('select[multiple]').length ) {
1583
        if( $('#report_param_form').find('select[multiple]').length ) {
1583
            $('#report_param_form').find('select[multiple]').each( function (i) {
1584
                $(this).on('change', function() {
1585
                    var $selected = $(this).val().join('\n');
1586
                    $(this).find('option:first').val($selected);
1587
                });
1588
            });
1589
1590
            $('#report_param_form').on('submit', function(e) {
1584
            $('#report_param_form').on('submit', function(e) {
1591
                $('#report_param_form').find('select[multiple]').each( function (i) {
1585
                $('#report_param_form').find('select[multiple]').each( function (i) {
1586
                    $(this).find('option:first').prop('disabled', false);
1587
                    var selection;
1592
                    if( $(this).find('option:selected').length === 0 ) {
1588
                    if( $(this).find('option:selected').length === 0 ) {
1593
                        $(this).val(['%']);
1589
                        selection = $(this).find('option:first').val();
1594
                    }
1590
                        $(this).val(selection);
1595
                    else if( $(this).find('option:selected').length > 1 ) {
1591
                    } else if( $(this).find('option:selected').length > 1 ) {
1596
                        var $selected = $('option:first', this).val();
1592
                        selection = $(this).val().join('\n');
1597
                        $(this).val($selected);
1593
                        $(this).find('option:selected').prop('selected', false);
1594
                        $(this).find('option:first').val(selection);
1595
                        $(this).find('option:first').prop('selected', 'selected');
1598
                    }
1596
                    }
1599
                });
1597
                });
1600
            });
1598
            });
Lines 2309-2314 Link Here
2309
                $("#limit").val( limit );
2307
                $("#limit").val( limit );
2310
                $("#limitselect").submit();
2308
                $("#limitselect").submit();
2311
            });
2309
            });
2310
2311
            // Apply select2 to all select fields having a "multiple" attribute
2312
            let selectFields = document.querySelectorAll('select[multiple]');
2313
            selectFields.forEach((selectField) => {
2314
                selectField.style.minWidth = '320px';
2315
                $(selectField).select2();
2316
            });
2312
        });
2317
        });
2313
2318
2314
        $("#toggle_auto_links").on("click", function(e){
2319
        $("#toggle_auto_links").on("click", function(e){
2315
- 

Return to bug 37050