]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/new-user-password.js
Fix timestamp in API docs example response
[bookstack] / resources / js / components / new-user-password.js
index 9c4c21c14cc0bae368f8bf9be2fd5abd546b8482..e294f8e97f3228ed5a111614bd0c697ff7323b81 100644 (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;
\ No newline at end of file