diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2021-07-07 20:41:44 +0300 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2021-07-08 17:43:46 +0300 |
commit | 090f860c658209d27d08bc1158fcd241b1020043 (patch) | |
tree | ecc0727a6fe517150dd905e32859839e76b7d525 /apps/settings/src | |
parent | 57e669e797d9b0be98f6958a39116f76270cf010 (diff) |
Fix add group button
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/views/Users.vue | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/apps/settings/src/views/Users.vue b/apps/settings/src/views/Users.vue index 54fc9024316..7fb7877eb84 100644 --- a/apps/settings/src/views/Users.vue +++ b/apps/settings/src/views/Users.vue @@ -38,7 +38,7 @@ :loading="loadingAddGroup" :title="t('settings', 'Add group')" icon="icon-add" - @click="toggleAddGroupEntry(true)" + @click="showAddGroupForm" @update:title="createGroup" /> <AppNavigationItem id="everyone" @@ -445,9 +445,6 @@ export default { async createGroup(gid) { // group is not valid if (gid.trim() === '') { - Vue.nextTick(() => { - this.toggleAddGroupEntry(true) - }) return } @@ -455,41 +452,33 @@ export default { this.loadingAddGroup = true await this.$store.dispatch('addGroup', gid.trim()) - this.toggleAddGroupEntry(false) - this.$router.push({ + this.hideAddGroupForm() + await this.$router.push({ name: 'group', params: { selectedGroup: encodeURIComponent(gid.trim()), }, }) } catch { - this.toggleAddGroupEntry(true) + this.showAddGroupForm() } finally { this.loadingAddGroup = false } }, - /** - * Toggle the add group entry editing state - * @param {boolean} [state] set state instead of toggling - */ - toggleAddGroupEntry(state) { - if (state === undefined) { - state = !this.$refs.addGroup.editing - } - this.$refs.addGroup.editing = state - - // focus input - Vue.nextTick(() => { - if (this.$refs.addGroup.$el) { - const input = this.$refs.addGroup.$el.querySelector('form > input[type="text"]') - if (input) { - input.focus() - } - } + showAddGroupForm() { + this.$refs.addGroup.editingActive = true + this.$refs.addGroup.onMenuToggle(false) + this.$nextTick(() => { + this.$refs.addGroup.$refs.editingInput.focusInput() }) }, + hideAddGroupForm() { + this.$refs.addGroup.editingActive = false + this.$refs.addGroup.editingValue = '' + }, + /** * Format a group to a menu entry * @param {Object} group the group |