mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 17:04:32 +08:00
Finished new user invite flow
This commit is contained in:
@ -28,6 +28,7 @@ import bookSort from "./book-sort";
|
||||
import settingAppColorPicker from "./setting-app-color-picker";
|
||||
import entityPermissionsEditor from "./entity-permissions-editor";
|
||||
import templateManager from "./template-manager";
|
||||
import newUserPassword from "./new-user-password";
|
||||
|
||||
const componentMapping = {
|
||||
'dropdown': dropdown,
|
||||
@ -60,6 +61,7 @@ const componentMapping = {
|
||||
'setting-app-color-picker': settingAppColorPicker,
|
||||
'entity-permissions-editor': entityPermissionsEditor,
|
||||
'template-manager': templateManager,
|
||||
'new-user-password': newUserPassword,
|
||||
};
|
||||
|
||||
window.components = {};
|
||||
|
28
resources/assets/js/components/new-user-password.js
Normal file
28
resources/assets/js/components/new-user-password.js
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
class NewUserPassword {
|
||||
|
||||
constructor(elem) {
|
||||
this.elem = elem;
|
||||
this.inviteOption = elem.querySelector('input[name=send_invite]');
|
||||
|
||||
if (this.inviteOption) {
|
||||
this.inviteOption.addEventListener('change', this.inviteOptionChange.bind(this));
|
||||
this.inviteOptionChange();
|
||||
}
|
||||
}
|
||||
|
||||
inviteOptionChange() {
|
||||
const inviting = (this.inviteOption.value === 'true');
|
||||
const passwordBoxes = this.elem.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';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default NewUserPassword;
|
@ -11,6 +11,11 @@ class ToggleSwitch {
|
||||
|
||||
stateChange() {
|
||||
this.input.value = (this.checkbox.checked ? 'true' : 'false');
|
||||
|
||||
// Dispatch change event from hidden input so they can be listened to
|
||||
// like a normal checkbox.
|
||||
const changeEvent = new Event('change');
|
||||
this.input.dispatchEvent(changeEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user