1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Updated a whole load more js components

This commit is contained in:
Dan Brown
2022-11-15 16:04:46 +00:00
parent b37e84dc10
commit db79167469
25 changed files with 152 additions and 184 deletions

View File

@ -1,9 +1,11 @@
import {Component} from "./component";
class NewUserPassword {
export class NewUserPassword extends Component {
constructor(elem) {
this.elem = elem;
this.inviteOption = elem.querySelector('input[name=send_invite]');
setup() {
this.container = this.$el;
this.inputContainer = this.$refs.inputContainer;
this.inviteOption = this.container.querySelector('input[name=send_invite]');
if (this.inviteOption) {
this.inviteOption.addEventListener('change', this.inviteOptionChange.bind(this));
@ -13,16 +15,12 @@ class NewUserPassword {
inviteOptionChange() {
const inviting = (this.inviteOption.value === 'true');
const passwordBoxes = this.elem.querySelectorAll('input[type=password]');
const passwordBoxes = this.container.querySelectorAll('input[type=password]');
for (const input of passwordBoxes) {
input.disabled = inviting;
}
const container = this.elem.querySelector('#password-input-container');
if (container) {
container.style.display = inviting ? 'none' : 'block';
}
this.inputContainer.style.display = inviting ? 'none' : 'block';
}
}
export default NewUserPassword;
}