mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
Merge pull request #27878 from nextcloud/backport/22/bug/27435/add-group-button
[stable22] Fix add group button
This commit is contained in:
commit
1826107f56
7 changed files with 20 additions and 31 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue