This commit is contained in:
Ludovic CANDELLIER
2021-10-04 13:49:45 +02:00
parent 9d21f28d9e
commit a7f661ab10
9 changed files with 42 additions and 14 deletions

View File

@@ -1,23 +1,27 @@
@if(!defined('LOAD_SELECT2'))
@push('scripts')
<script src="{{ asset('/assets/plugins/select2/js/select2.full.min.js') }}"></script>
<script src="{{ asset('/assets/plugins/select2/js/i18n/' . App::getLocale() .'.js') }}"></script>
<script src="/assets/plugins/select2/js/select2.full.min.js"></script>
<script src="/assets/plugins/select2/js/i18n/" . App::getLocale() . ".js"></script>
<script>
function initSelect2() {
$(".select2").select2({
function initSelect2(sel) {
var selector = (typeof(sel) == 'undefined') ? '.select2' : sel;
$(selector).select2({
placeholder: "{{ __('select_a_value') }}",
allowClear: false,
width: {
value: '100%'
}
});
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});
}
</script>
@endpush
@push('css')
<link rel="stylesheet" href="{!! asset('/assets/plugins/select2/css/select2.min.css') !!}">
<link rel="stylesheet" href="/assets/plugins/select2/css/select2.min.css">
@endpush
@php(define('LOAD_SELECT2', true))
@endif