1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-15 12:41:52 +03:00

Started the migration of the setting views

This commit is contained in:
Dan Brown
2019-02-02 15:49:57 +00:00
parent 20988962fe
commit 880d4f35da
24 changed files with 666 additions and 529 deletions

View File

@ -3,15 +3,15 @@ class ToggleSwitch {
constructor(elem) {
this.elem = elem;
this.input = elem.querySelector('input');
this.input = elem.querySelector('input[type=hidden]');
this.checkbox = elem.querySelector('input[type=checkbox]');
this.elem.onclick = this.onClick.bind(this);
this.checkbox.addEventListener('change', this.onClick.bind(this));
}
onClick(event) {
let checked = this.input.value !== 'true';
let checked = this.checkbox.checked;
this.input.value = checked ? 'true' : 'false';
checked ? this.elem.classList.add('active') : this.elem.classList.remove('active');
}
}