Use app nav children for categories
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
This commit is contained in:
@@ -26,40 +26,47 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import { AppNavigation } from 'nextcloud-vue'
|
import AppNavigation from 'nextcloud-vue/src/components/AppNavigation/AppNavigation'
|
||||||
import { translate as t } from 'nextcloud-server/dist/l10n'
|
import { translate as t } from 'nextcloud-server/dist/l10n'
|
||||||
import { boardToMenuItem } from './../helpers/boardToMenuItem'
|
import { boardToMenuItem } from './../helpers/boardToMenuItem'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
import store from './../store/main'
|
import store from './../store/main'
|
||||||
|
|
||||||
const defaultCategories = [
|
const categoryAll = {
|
||||||
{
|
id: 'deck-boards',
|
||||||
id: 'deck-boards',
|
classes: [],
|
||||||
classes: [],
|
icon: 'icon-deck',
|
||||||
icon: 'icon-deck',
|
text: t('deck', 'All boards'),
|
||||||
text: t('deck', 'All boards'),
|
router: {
|
||||||
router: {
|
name: 'boards'
|
||||||
name: 'boards'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
collapsible: false,
|
||||||
id: 'deck-boards-archived',
|
children: []
|
||||||
classes: [],
|
}
|
||||||
icon: 'icon-archive',
|
|
||||||
text: t('deck', 'Archived boards'),
|
const categoryArchived = {
|
||||||
router: {
|
id: 'deck-boards-archived',
|
||||||
name: 'boards.archived'
|
classes: [],
|
||||||
}
|
icon: 'icon-archive',
|
||||||
|
text: t('deck', 'Archived boards'),
|
||||||
|
router: {
|
||||||
|
name: 'boards.archived'
|
||||||
},
|
},
|
||||||
{
|
collapsible: false,
|
||||||
id: 'deck-boards-shared',
|
children: []
|
||||||
classes: [],
|
}
|
||||||
icon: 'icon-shared',
|
|
||||||
text: t('deck', 'Shared boards'),
|
const categoryShared = {
|
||||||
router: {
|
id: 'deck-boards-shared',
|
||||||
name: 'boards.shared'
|
classes: [],
|
||||||
}
|
icon: 'icon-shared',
|
||||||
}
|
text: t('deck', 'Shared boards'),
|
||||||
]
|
router: {
|
||||||
|
name: 'boards.shared'
|
||||||
|
},
|
||||||
|
collapsible: false,
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
|
||||||
const addButton = {
|
const addButton = {
|
||||||
icon: 'icon-add',
|
icon: 'icon-add',
|
||||||
@@ -96,11 +103,54 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'noneArchivedBoards',
|
||||||
|
'archivedBoards',
|
||||||
|
'sharedBoards'
|
||||||
|
]),
|
||||||
|
allBoardsNavItem: function() {
|
||||||
|
return {
|
||||||
|
id: 'deck-boards',
|
||||||
|
classes: [],
|
||||||
|
icon: 'icon-deck',
|
||||||
|
text: t('deck', 'All boards'),
|
||||||
|
router: {
|
||||||
|
name: 'boards'
|
||||||
|
},
|
||||||
|
collapsible: true,
|
||||||
|
children: this.noneArchivedBoards.map(boardToMenuItem)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
archivedBoardsNavItem: function() {
|
||||||
|
return {
|
||||||
|
id: 'deck-boards-archived',
|
||||||
|
classes: [],
|
||||||
|
icon: 'icon-archive',
|
||||||
|
text: t('deck', 'Archived boards'),
|
||||||
|
router: {
|
||||||
|
name: 'boards.archived'
|
||||||
|
},
|
||||||
|
collapsible: true,
|
||||||
|
children: this.archivedBoards.map(boardToMenuItem)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sharedBoardsNavItem: function() {
|
||||||
|
return {
|
||||||
|
id: 'deck-boards-shared',
|
||||||
|
classes: [],
|
||||||
|
icon: 'icon-shared',
|
||||||
|
text: t('deck', 'Shared boards'),
|
||||||
|
router: {
|
||||||
|
name: 'boards.shared'
|
||||||
|
},
|
||||||
|
collapsible: false,
|
||||||
|
children: this.sharedBoards.map(boardToMenuItem)
|
||||||
|
}
|
||||||
|
},
|
||||||
menu: function() {
|
menu: function() {
|
||||||
return {
|
return {
|
||||||
loading: this.loading,
|
loading: this.loading,
|
||||||
items: defaultCategories
|
items: [this.allBoardsNavItem, this.archivedBoardsNavItem, this.sharedBoardsNavItem]
|
||||||
.concat(this.$store.getters.noneArchivedBoards.map(boardToMenuItem))
|
|
||||||
.concat([this.addButton])
|
.concat([this.addButton])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import VTooltip from 'v-tooltip'
|
|||||||
* @typedef {Object} Board
|
* @typedef {Object} Board
|
||||||
* @property {String} title
|
* @property {String} title
|
||||||
* @property {boolean} archived
|
* @property {boolean} archived
|
||||||
|
* @property {number} shared 1 (shared) or 0 (not shared)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ export default new Vuex.Store({
|
|||||||
return board.archived === false
|
return board.archived === false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
archivedBoards: state => {
|
||||||
|
return state.boards.filter(board => {
|
||||||
|
return board.archived === true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sharedBoards: state => {
|
||||||
|
return state.boards.filter(board => {
|
||||||
|
return board.shared
|
||||||
|
})
|
||||||
|
},
|
||||||
filteredBoards: state => {
|
filteredBoards: state => {
|
||||||
// filters the boards depending on the active filter
|
// filters the boards depending on the active filter
|
||||||
const boards = state.boards.filter(board => {
|
const boards = state.boards.filter(board => {
|
||||||
|
|||||||
Reference in New Issue
Block a user