mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-02 22:03:48 +08:00
8716b1922b
Got webhook CRUD actions in place within the interface. Quick manual test pass done, Needs automated tests.
32 lines
874 B
JavaScript
32 lines
874 B
JavaScript
|
|
/**
|
|
* Webhook Events
|
|
* Manages dynamic selection control in the webhook form interface.
|
|
* @extends {Component}
|
|
*/
|
|
class WebhookEvents {
|
|
|
|
setup() {
|
|
this.checkboxes = this.$el.querySelectorAll('input[type="checkbox"]');
|
|
this.allCheckbox = this.$el.querySelector('input[type="checkbox"][value="all"]');
|
|
|
|
this.$el.addEventListener('change', event => {
|
|
if (event.target.checked && event.target === this.allCheckbox) {
|
|
this.deselectIndividualEvents();
|
|
} else if (event.target.checked) {
|
|
this.allCheckbox.checked = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
deselectIndividualEvents() {
|
|
for (const checkbox of this.checkboxes) {
|
|
if (checkbox !== this.allCheckbox) {
|
|
checkbox.checked = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export default WebhookEvents; |