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 (-17 / +23 lines)
Lines 907-916 Link Here
907
                                        [% ELSE %]
907
                                        [% ELSE %]
908
                                            <li>
908
                                            <li>
909
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
909
                                                <label for="sql_params_[% sql_param.labelid | html %]">[% sql_param.entry | html %]:</label>
910
                                                <select name="[%- sql_param.input.name | html -%]" tabindex="1" id="[%- sql_param.input.id | html -%]" [% IF sql_param.select_multiple %]multiple[% END %]>
910
                                                [% IF (sql_param.select_multiple) %]
911
                                                    [% IF (sql_param.select_multiple) %]
911
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]" multiple>
912
                                                        <option value="%" hidden></option>
912
                                                        <option value="[% sql_param.input.values.join("\n") | html %]" disabled="disabled"></option>
913
                                                    [% END %]
913
                                                [% ELSE %]
914
                                                    <select name="[%- sql_param.input.name | html -%]" tabindex="1"  id="[%- sql_param.input.id | html -%]">
915
                                                [% END %]
914
                                                    [% IF (sql_param.include_all) %]
916
                                                    [% IF (sql_param.include_all) %]
915
                                                        <option value="%">All</option>
917
                                                        <option value="%">All</option>
916
                                                    [% END %]
918
                                                    [% END %]
Lines 1711-1734 Link Here
1711
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1713
    [% Asset.css("lib/codemirror/highlight.css") | $raw %]
1712
    [% Asset.js( "js/mana.js" ) | $raw %]
1714
    [% Asset.js( "js/mana.js" ) | $raw %]
1713
    [% Asset.js("js/form-submit.js") | $raw %]
1715
    [% Asset.js("js/form-submit.js") | $raw %]
1716
    [% INCLUDE 'select2.inc' %]
1714
    <script>
1717
    <script>
1715
        //  if the report param form has multiselects override default form submission
1718
        //  if the report param form has multiselects override default form submission
1716
        if( $('#report_param_form').find('select[multiple]').length ) {
1719
        if( $('#report_param_form').find('select[multiple]').length ) {
1717
            $('#report_param_form').find('select[multiple]').each( function (i) {
1718
                $(this).on('change', function() {
1719
                    var $selected = $(this).val().join('\n');
1720
                    $(this).find('option:first').val($selected);
1721
                });
1722
            });
1723
1724
            $('#report_param_form').on('submit', function(e) {
1720
            $('#report_param_form').on('submit', function(e) {
1725
                $('#report_param_form').find('select[multiple]').each( function (i) {
1721
                $('#report_param_form').find('select[multiple]').each( function (i) {
1722
                    $(this).find('option:first').prop('disabled', false);
1723
                    var selection;
1726
                    if( $(this).find('option:selected').length === 0 ) {
1724
                    if( $(this).find('option:selected').length === 0 ) {
1727
                        $(this).val(['%']);
1725
                        selection = $(this).find('option:first').val();
1728
                    }
1726
                        $(this).val(selection);
1729
                    else if( $(this).find('option:selected').length > 1 ) {
1727
                    } else if( $(this).find('option:selected').length > 1 ) {
1730
                        var $selected = $('option:first', this).val();
1728
                        selection = $(this).val().join('\n');
1731
                        $(this).val($selected);
1729
                        $(this).find('option:selected').prop('selected', false);
1730
                        $(this).find('option:first').val(selection);
1731
                        $(this).find('option:first').prop('selected', 'selected');
1732
                    }
1732
                    }
1733
                });
1733
                });
1734
            });
1734
            });
Lines 2445-2450 Link Here
2445
                $("#limit").val( limit );
2445
                $("#limit").val( limit );
2446
                $("#limitselect").submit();
2446
                $("#limitselect").submit();
2447
            });
2447
            });
2448
2449
            // Apply select2 to all select fields having a "multiple" attribute
2450
            let selectFields = document.querySelectorAll('select[multiple]');
2451
            selectFields.forEach((selectField) => {
2452
                selectField.style.minWidth = '320px';
2453
                $(selectField).select2();
2454
            });
2448
        });
2455
        });
2449
2456
2450
        $("#toggle_auto_links").on("click", function(e){
2457
        $("#toggle_auto_links").on("click", function(e){
2451
- 

Return to bug 37050