- trop de trucs d'un coup... je vais faire attention ensuite ^^'
This commit is contained in:
21
assets/controllers/bootstrap-modal_controller.js
vendored
Normal file
21
assets/controllers/bootstrap-modal_controller.js
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
import { Modal } from 'bootstrap';
|
||||
|
||||
/**
|
||||
* Allows you to dispatch a "modal:close" JavaScript event to close it.
|
||||
*
|
||||
* This is useful inside a LiveComponent, where you can emit a browser event
|
||||
* to open or close the modal.
|
||||
*
|
||||
* See templates/components/BootstrapModal.html.twig to see how this is
|
||||
* attached to Bootstrap modal.
|
||||
*/
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
modal = null;
|
||||
|
||||
connect() {
|
||||
this.modal = Modal.getOrCreateInstance(this.element);
|
||||
document.addEventListener('modal:close', () => this.modal.hide());
|
||||
}
|
||||
}
|
||||
15
assets/controllers/search_controller.js
Normal file
15
assets/controllers/search_controller.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
/*
|
||||
* The following line makes this controller "lazy": it won't be downloaded until needed
|
||||
* See https://github.com/symfony/stimulus-bridge#lazy-controllers
|
||||
*/
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
static targets = ['input']
|
||||
|
||||
clearSearch() {
|
||||
this.inputTarget.value = '';
|
||||
this.inputTarget.focus();
|
||||
}
|
||||
}
|
||||
24
assets/controllers/table_controller.js
Normal file
24
assets/controllers/table_controller.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Controller} from '@hotwired/stimulus';
|
||||
|
||||
/*
|
||||
* The following line makes this controller "lazy": it won't be downloaded until needed
|
||||
* See https://github.com/symfony/stimulus-bridge#lazy-controllers
|
||||
*/
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
static targets = ['body']
|
||||
|
||||
// ...
|
||||
collapse(event) {
|
||||
if (this.bodyTarget.style.display === "none") {
|
||||
this.bodyTarget.style.display = "block";
|
||||
event.currentTarget.classList.remove('fa-chevron-up');
|
||||
event.currentTarget.classList.add('fa-chevron-down');
|
||||
} else {
|
||||
this.bodyTarget.style.display = "none";
|
||||
event.currentTarget.classList.remove('fa-chevron-down');
|
||||
event.currentTarget.classList.add('fa-chevron-up');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user