From 6e1e6a895739c8d5fd8d7d1cfea365589fa9e3d9 Mon Sep 17 00:00:00 2001 From: Johannes Szeibert Date: Fri, 14 Jul 2023 11:26:59 +0000 Subject: [PATCH 1/2] introduce Card Covers Signed-off-by: Johannes Szeibert --- src/components/Controls.vue | 12 ++++ src/components/cards/CardCover.vue | 100 +++++++++++++++++++++++++++++ src/components/cards/CardItem.vue | 5 +- src/store/main.js | 8 +++ 4 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 src/components/cards/CardCover.vue diff --git a/src/components/Controls.vue b/src/components/Controls.vue index b6972b610..b2396bfd0 100644 --- a/src/components/Controls.vue +++ b/src/components/Controls.vue @@ -208,6 +208,12 @@ {{ t('deck', 'Toggle compact mode') }} + + + {{ showCardCover ? t('deck', 'Hide card cover images') : t('deck', 'Show card cover images') }} + @@ -226,6 +232,7 @@ import { mapState, mapGetters } from 'vuex' import { NcActions, NcActionButton, NcAvatar, NcButton, NcPopover, NcModal } from '@nextcloud/vue' import labelStyle from '../mixins/labelStyle.js' import ArchiveIcon from 'vue-material-design-icons/Archive.vue' +import ImageIcon from 'vue-material-design-icons/ImageMultiple.vue' import FilterIcon from 'vue-material-design-icons/Filter.vue' import FilterOffIcon from 'vue-material-design-icons/FilterOff.vue' import ArrowCollapseVerticalIcon from 'vue-material-design-icons/ArrowCollapseVertical.vue' @@ -245,6 +252,7 @@ export default { NcPopover, NcAvatar, ArchiveIcon, + ImageIcon, FilterIcon, FilterOffIcon, ArrowCollapseVerticalIcon, @@ -285,6 +293,7 @@ export default { ]), ...mapState({ compactMode: state => state.compactMode, + showCardCover: state => state.showCardCover, searchQuery: state => state.searchQuery, }), detailsRoute() { @@ -339,6 +348,9 @@ export default { toggleCompactMode() { this.$store.dispatch('toggleCompactMode') }, + toggleShowCardCover() { + this.$store.dispatch('toggleShowCardCover') + }, toggleShowArchived() { this.$store.dispatch('toggleShowArchived') this.showArchived = !this.showArchived diff --git a/src/components/cards/CardCover.vue b/src/components/cards/CardCover.vue new file mode 100644 index 000000000..88c84a0db --- /dev/null +++ b/src/components/cards/CardCover.vue @@ -0,0 +1,100 @@ + + + + + + diff --git a/src/components/cards/CardItem.vue b/src/components/cards/CardItem.vue index a46ffcc9f..68f1b560c 100644 --- a/src/components/cards/CardItem.vue +++ b/src/components/cards/CardItem.vue @@ -34,6 +34,7 @@
{{ board.title }} » {{ stack.title }}
+

{{ card.title }} @@ -92,10 +93,11 @@ import labelStyle from '../../mixins/labelStyle.js' import AttachmentDragAndDrop from '../AttachmentDragAndDrop.vue' import CardMenu from './CardMenu.vue' import DueDate from './badges/DueDate.vue' +import CardCover from './CardCover.vue' export default { name: 'CardItem', - components: { CardBadges, AttachmentDragAndDrop, CardMenu, DueDate }, + components: { CardBadges, AttachmentDragAndDrop, CardMenu, DueDate, CardCover }, directives: { ClickOutside, }, @@ -129,6 +131,7 @@ export default { compactMode: state => state.compactMode, showArchived: state => state.showArchived, currentBoard: state => state.currentBoard, + showCardCover: state => state.showCardCover, }), ...mapGetters([ 'isArchived', diff --git a/src/store/main.js b/src/store/main.js index 31b52c84c..3df2e70fa 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -62,6 +62,7 @@ export default new Vuex.Store({ showArchived: false, navShown: localStorage.getItem('deck.navShown') === null || localStorage.getItem('deck.navShown') === 'true', compactMode: localStorage.getItem('deck.compactMode') === 'true', + showCardCover: localStorage.getItem('deck.showCardCover') === 'true', sidebarShown: false, currentBoard: null, currentCard: null, @@ -229,6 +230,10 @@ export default new Vuex.Store({ state.compactMode = !state.compactMode localStorage.setItem('deck.compactMode', state.compactMode) }, + toggleShowCardCover(state) { + state.showCardCover = !state.showCardCover + localStorage.setItem('deck.showCardCover', state.showCardCover) + }, setBoards(state, boards) { state.boards = boards }, @@ -439,6 +444,9 @@ export default new Vuex.Store({ toggleCompactMode({ commit }) { commit('toggleCompactMode') }, + toggleShowCardCover({ commit }) { + commit('toggleShowCardCover') + }, setCurrentBoard({ commit }, board) { commit('setCurrentBoard', board) }, From 24b7c232f25ff455f60151f1c8782a07623329bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 17 Oct 2023 12:29:16 +0200 Subject: [PATCH 2/2] fix: Only request attachments if there are any MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/cards/CardCover.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/cards/CardCover.vue b/src/components/cards/CardCover.vue index 88c84a0db..b685aeb59 100644 --- a/src/components/cards/CardCover.vue +++ b/src/components/cards/CardCover.vue @@ -65,7 +65,9 @@ export default { cardId: { immediate: true, handler() { - this.fetchAttachments(this.cardId) + if (this.$store.getters.cardById(this.cardId)?.attachmentCount > 0) { + this.fetchAttachments(this.cardId) + } }, }, },