parent
0ee768b070
commit
c33f6c648e
File diff suppressed because one or more lines are too long
@ -0,0 +1,30 @@
|
||||
function addBSFormClass() {
|
||||
document.querySelectorAll('textarea,input[type="text"],input[type="number"]').forEach(
|
||||
(elem) => elem.classList.add('form-control')
|
||||
);
|
||||
document.querySelectorAll('input[type="checkbox"]').forEach(
|
||||
(elem) => elem.classList.add('form-check-input')
|
||||
);
|
||||
document.querySelectorAll('select').forEach(
|
||||
(elem) => elem.classList.add('form-select')
|
||||
);
|
||||
$('.select2').select2({
|
||||
width: '10em',
|
||||
});
|
||||
}
|
||||
|
||||
function scrollToRow(e) {
|
||||
conf = e.detail.requestConfig;
|
||||
if (conf.path.includes('row')) {
|
||||
elt = e.detail.elt;
|
||||
rect = elt.getBoundingClientRect();
|
||||
if (rect.top < 0 || rect.bottom < 0) {
|
||||
elt.scrollIntoView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('htmx:afterSettle', function(e) {
|
||||
addBSFormClass();
|
||||
scrollToRow(e);
|
||||
})
|
Loading…
Reference in new issue