Fix bug on select2 in modal filters, add filters by tags and shelves on articles

This commit is contained in:
Ludovic CANDELLIER
2022-01-30 15:04:08 +01:00
parent 5799eb36fc
commit 5e5f12ddb2
6 changed files with 64 additions and 15 deletions

View File

@@ -4,25 +4,43 @@
<script src="/assets/plugins/select2/js/i18n/{{ App::getLocale() }}.js"></script>
<script>
function initSelect2(sel) {
var selector = (typeof(sel) == 'undefined') ? '.select2' : sel;
$(selector).select2({
placeholder: "{{ __('select_a_value') }}",
allowClear: false,
width: {
value: '100%'
}
});
function initSelect2(sel, parent) {
console.log('initSelect2');
// $.fn.modal.Constructor.prototype.enforceFocus = function() {};
$(document).on('select2:open',(e) => {
var selector = (typeof(sel) == 'undefined') ? '.select2' : sel;
if (typeof(parent) == 'undefined') {
$(selector).select2({
placeholder: "{{ __('select_a_value') }}",
allowClear: false,
width: {
value: '100%'
}
});
} else {
$(selector).select2({
placeholder: "{{ __('select_a_value') }}",
allowClear: true,
dropdownParent: $(parent),
width: {
value: '100%'
}
});
}
/*
$(selector).on('select2:open',(e) => {
let t = $(e.target);
console.log(t);
if (t && t.length) {
let id = t[0].id || t[0].name;
let item = document.querySelector(`input[aria-controls*='${id}']`);
console.log(id);
let item = $(`input[aria-controls*='${id}']`);
console.log(item);
return item ? item.focus() : false;
}
});
*/
}
</script>
@endpush