Add group settings to sidebar
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -41,25 +41,28 @@
|
|||||||
icon="icon-shared" />
|
icon="icon-shared" />
|
||||||
<app-navigation-add-board />
|
<app-navigation-add-board />
|
||||||
</ul>
|
</ul>
|
||||||
<div v-click-outside="closeMenu" v-if="!!$slots['settings-content']" id="app-settings"
|
<div v-click-outside="closeMenu" v-if="isAdmin"
|
||||||
:class="{open: opened}">
|
id="app-settings" :class="{open: opened}">
|
||||||
<div id="app-settings-header">
|
<div id="app-settings-header">
|
||||||
<button class="settings-button"
|
<button class="settings-button" @click="toggleMenu">
|
||||||
data-apps-slide-toggle="#app-settings-content"
|
{{ t('deck', 'Settings') }}
|
||||||
@click="toggleMenu">
|
|
||||||
{{ t('contacts', 'Settings') }}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="app-settings-content">
|
<div id="app-settings-content">
|
||||||
<slot name="settings-content" />
|
<Multiselect :options="groups" :multiple="true" v-model="groupLimit"
|
||||||
|
:disabled="groupLimitDisabled" label="displayname" track-by="id"
|
||||||
|
@input="updateConfig" />
|
||||||
|
<p>{{ t('deck', 'Limiting Deck will block users not part of those groups from creating their own boards. Users will still be able to work on boards that have been shared with them.') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'nextcloud-axios'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import ClickOutside from 'vue-click-outside'
|
import ClickOutside from 'vue-click-outside'
|
||||||
|
import { Multiselect } from 'nextcloud-vue'
|
||||||
|
|
||||||
import AppNavigationAddBoard from './AppNavigationAddBoard'
|
import AppNavigationAddBoard from './AppNavigationAddBoard'
|
||||||
import AppNavigationBoard from './AppNavigationBoard'
|
import AppNavigationBoard from './AppNavigationBoard'
|
||||||
@@ -70,7 +73,8 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
AppNavigationAddBoard,
|
AppNavigationAddBoard,
|
||||||
AppNavigationBoard,
|
AppNavigationBoard,
|
||||||
AppNavigationBoardCategory
|
AppNavigationBoardCategory,
|
||||||
|
Multiselect
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
ClickOutside
|
ClickOutside
|
||||||
@@ -83,7 +87,10 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
opened: false
|
opened: false,
|
||||||
|
groups: [],
|
||||||
|
groupLimit: [],
|
||||||
|
groupLimitDisabled: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -91,7 +98,32 @@ export default {
|
|||||||
'noneArchivedBoards',
|
'noneArchivedBoards',
|
||||||
'archivedBoards',
|
'archivedBoards',
|
||||||
'sharedBoards'
|
'sharedBoards'
|
||||||
])
|
]),
|
||||||
|
isAdmin() {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
return oc_isadmin
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeMount() {
|
||||||
|
if (this.isAdmin) {
|
||||||
|
axios.get(OC.generateUrl('apps/deck/config')).then((response) => {
|
||||||
|
this.groupLimit = response.data.groupLimit
|
||||||
|
this.groupLimitDisabled = false
|
||||||
|
}, (error) => {
|
||||||
|
console.error('Error while loading groupLimit', error.response)
|
||||||
|
})
|
||||||
|
axios.get(OC.linkToOCS('cloud', 2) + 'groups').then((response) => {
|
||||||
|
this.groups = response.data.ocs.data.groups.reduce((obj, item) => {
|
||||||
|
obj.push({
|
||||||
|
id: item,
|
||||||
|
displayname: item
|
||||||
|
})
|
||||||
|
return obj
|
||||||
|
}, [])
|
||||||
|
}, (error) => {
|
||||||
|
console.error('Error while loading group list', error.response)
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleMenu() {
|
toggleMenu() {
|
||||||
@@ -99,7 +131,22 @@ export default {
|
|||||||
},
|
},
|
||||||
closeMenu() {
|
closeMenu() {
|
||||||
this.opened = false
|
this.opened = false
|
||||||
|
},
|
||||||
|
updateConfig() {
|
||||||
|
this.groupLimitDisabled = true
|
||||||
|
axios.post(OC.generateUrl('apps/deck/config/groupLimit'), {
|
||||||
|
value: this.groupLimit
|
||||||
|
}).then(() => {
|
||||||
|
this.groupLimitDisabled = false
|
||||||
|
}, (error) => {
|
||||||
|
console.error('Error while saving groupLimit', error.response)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style>
|
||||||
|
.multiselect {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user