Skip to content

Commit cd38436

Browse files
authored
Merge pull request #7675 from ramteid/feature/default-board
feat(board): A board can be pinned as default board
2 parents 944c316 + d871610 commit cd38436

8 files changed

Lines changed: 50 additions & 6 deletions

File tree

l10n/de.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ OC.L10N.register(
411411
"Save" : "Speichern",
412412
"Today" : "Heute",
413413
"Tomorrow" : "Morgen",
414-
"No due" : "Kein Fälligkeitsdatum"
414+
"No due" : "Kein Fälligkeitsdatum",
415+
"Set as default board" : "Als Standard-Board festlegen",
416+
"Remove as default board" : "Als Standard-Board entfernen"
415417
},
416418
"nplurals=2; plural=(n != 1);");

l10n/de.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@
409409
"Save" : "Speichern",
410410
"Today" : "Heute",
411411
"Tomorrow" : "Morgen",
412-
"No due" : "Kein Fälligkeitsdatum"
412+
"No due" : "Kein Fälligkeitsdatum",
413+
"Set as default board" : "Als Standard-Board festlegen",
414+
"Remove as default board" : "Als Standard-Board entfernen"
413415
},"pluralForm" :"nplurals=2; plural=(n != 1);"
414416
}

l10n/de_DE.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ OC.L10N.register(
411411
"Save" : "Speichern",
412412
"Today" : "Heute",
413413
"Tomorrow" : "Morgen",
414-
"No due" : "Kein Fälligkeitsdatum"
414+
"No due" : "Kein Fälligkeitsdatum",
415+
"Set as default board" : "Als Standard-Board festlegen",
416+
"Remove as default board" : "Als Standard-Board entfernen"
415417
},
416418
"nplurals=2; plural=(n != 1);");

l10n/de_DE.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@
409409
"Save" : "Speichern",
410410
"Today" : "Heute",
411411
"Tomorrow" : "Morgen",
412-
"No due" : "Kein Fälligkeitsdatum"
412+
"No due" : "Kein Fälligkeitsdatum",
413+
"Set as default board" : "Als Standard-Board festlegen",
414+
"Remove as default board" : "Als Standard-Board entfernen"
413415
},"pluralForm" :"nplurals=2; plural=(n != 1);"
414416
}

l10n/en_GB.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ OC.L10N.register(
411411
"Save" : "Save",
412412
"Today" : "Today",
413413
"Tomorrow" : "Tomorrow",
414-
"No due" : "No due"
414+
"No due" : "No due",
415+
"Set as default board" : "Set as default board",
416+
"Remove as default board" : "Remove as default board"
415417
},
416418
"nplurals=2; plural=(n != 1);");

l10n/en_GB.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@
409409
"Save" : "Save",
410410
"Today" : "Today",
411411
"Tomorrow" : "Tomorrow",
412-
"No due" : "No due"
412+
"No due" : "No due",
413+
"Set as default board" : "Set as default board",
414+
"Remove as default board" : "Remove as default board"
413415
},"pluralForm" :"nplurals=2; plural=(n != 1);"
414416
}

src/components/navigation/AppNavigationBoard.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
<NcActionButton v-if="!board.archived && board.acl?.length === 0" :icon="board.settings['notify-due'] === 'off' ? 'icon-sound' : 'icon-sound-off'" @click="board.settings['notify-due'] === 'off' ? updateSetting('notify-due', 'all') : updateSetting('notify-due', 'off')">
7373
{{ board.settings['notify-due'] === 'off' ? t('deck', 'Turn on due date reminders') : t('deck', 'Turn off due date reminders') }}
7474
</NcActionButton>
75+
<NcActionButton :close-after-click="true" @click="toggleDefaultBoard">
76+
<template #icon>
77+
<PinOffIcon v-if="isDefaultBoard" :size="20" decorative />
78+
<PinIcon v-else :size="20" decorative />
79+
</template>
80+
{{ isDefaultBoard ? t('deck', 'Remove as default board') : t('deck', 'Set as default board') }}
81+
</NcActionButton>
7582
</template>
7683

7784
<!-- Due date reminder settings -->
@@ -172,6 +179,8 @@ import LeaveIcon from 'vue-material-design-icons/ExitRun.vue'
172179
import AccountIcon from 'vue-material-design-icons/AccountOutline.vue'
173180
import CloseIcon from 'vue-material-design-icons/Close.vue'
174181
import CheckIcon from 'vue-material-design-icons/Check.vue'
182+
import PinIcon from 'vue-material-design-icons/Pin.vue'
183+
import PinOffIcon from 'vue-material-design-icons/PinOff.vue'
175184
176185
import { loadState } from '@nextcloud/initial-state'
177186
import { emit } from '@nextcloud/event-bus'
@@ -198,6 +207,8 @@ export default {
198207
CloneIcon,
199208
CloseIcon,
200209
CheckIcon,
210+
PinIcon,
211+
PinOffIcon,
201212
LeaveIcon,
202213
BoardCloneModal,
203214
BoardExportModal,
@@ -231,6 +242,7 @@ export default {
231242
cloneModalOpen: false,
232243
exportModalOpen: false,
233244
currentUser: getCurrentUser(),
245+
defaultBoardId: localStorage.getItem('deck.defaultBoardId'),
234246
}
235247
},
236248
computed: {
@@ -275,13 +287,25 @@ export default {
275287
}
276288
return ''
277289
},
290+
isDefaultBoard() {
291+
return this.defaultBoardId === String(this.board.id)
292+
},
278293
},
279294
watch: {},
280295
mounted() {
281296
// prevent click outside event with popupItem.
282297
this.popupItem = this.$el
283298
},
284299
methods: {
300+
toggleDefaultBoard() {
301+
if (this.isDefaultBoard) {
302+
localStorage.removeItem('deck.defaultBoardId')
303+
this.defaultBoardId = null
304+
} else {
305+
localStorage.setItem('deck.defaultBoardId', String(this.board.id))
306+
this.defaultBoardId = String(this.board.id)
307+
}
308+
},
285309
unDelete() {
286310
clearTimeout(this.undoTimeoutHandle)
287311
this.boardApi.unDeleteBoard(this.board)

src/router.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ router.beforeEach((to, from, next) => {
155155
next(path)
156156
return
157157
}
158+
// Redirect to the pinned default board if set and navigating to the main route
159+
if (to.name === 'main') {
160+
const defaultBoardId = localStorage.getItem('deck.defaultBoardId')
161+
if (defaultBoardId) {
162+
next({ name: 'board', params: { id: parseInt(defaultBoardId, 10) } })
163+
return
164+
}
165+
}
158166
next()
159167
})
160168

0 commit comments

Comments
 (0)