1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Improved user-permissions adding ux

- Reset input after user selection.
- Corrected permission row title text for user rows.
This commit is contained in:
Dan Brown
2022-12-10 14:48:19 +00:00
parent 7a269e7689
commit 93cbd3b8aa
4 changed files with 16 additions and 1 deletions

View File

@@ -86,6 +86,10 @@ export class EntityPermissions extends Component {
toggle.classList.remove('disabled');
this.userContainer.style.pointerEvents = null;
/** @var {UserSelect} **/
const userSelect = window.$components.firstOnElement(this.userSelectContainer.querySelector('.dropdown-search'), 'user-select');
userSelect.reset();
}
removeRowOnButtonClick(button) {

View File

@@ -8,6 +8,9 @@ export class UserSelect extends Component {
this.input = this.$refs.input;
this.userInfoContainer = this.$refs.userInfo;
this.initialValue = this.input.value;
this.initialContent = this.userInfoContainer.innerHTML;
onChildEvent(this.container, 'a.dropdown-search-item', 'click', this.selectUser.bind(this));
}
@@ -19,6 +22,13 @@ export class UserSelect extends Component {
this.hide();
}
reset() {
this.input.value = this.initialValue;
this.userInfoContainer.innerHTML = this.initialContent;
this.input.dispatchEvent(new Event('change', {bubbles: true}));
this.hide();
}
hide() {
/** @var {Dropdown} **/
const dropdown = window.$components.firstOnElement(this.container, 'dropdown');