From 35e7c7dbe7535e893a44b019f36b3df2021593ad Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 16 Aug 2019 10:30:50 +0200 Subject: [PATCH 1/4] changed time calculation Signed-off-by: Jakob --- src/components/card/CardSidebar.vue | 4 ++-- src/components/cards/CardBadges.vue | 22 ++-------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/components/card/CardSidebar.vue b/src/components/card/CardSidebar.vue index 8545310f0..4d2362d7c 100644 --- a/src/components/card/CardSidebar.vue +++ b/src/components/card/CardSidebar.vue @@ -108,8 +108,8 @@ export default { return this.$store.getters.cardById(this.id) }, subtitle() { - let lastModified = this.currentCard.lastModified - let createdAt = this.currentCard.createdAt + let lastModified = OC.Util.relativeModifiedDate(this.currentCard.lastModified * 1000) + let createdAt = OC.Util.relativeModifiedDate(this.currentCard.createdAt * 1000) return t('deck', 'Modified') + ': ' + lastModified + ' ' + t('deck', 'Created') + ': ' + createdAt }, diff --git a/src/components/cards/CardBadges.vue b/src/components/cards/CardBadges.vue index 047f84009..ded079ab7 100644 --- a/src/components/cards/CardBadges.vue +++ b/src/components/cards/CardBadges.vue @@ -59,7 +59,7 @@ export default { dueIcon() { let timeInHours = Math.round((Date.parse(this.card.duedate) - Date.now()) / 1000 / 60 / 60 / 24) - if (timeInHours === 1) { + if (timeInHours >= 1) { return 'icon-calendar-dark due icon next' } if (timeInHours === 0) { @@ -70,25 +70,7 @@ export default { } }, dueTimeDiff() { - let unit = 'Minutes' - let timeInMin = (Date.parse(this.card.duedate) - Date.now()) / 60000 - - if (timeInMin > 59) { - timeInMin /= 60 - unit = 'Hours' - } - - if (timeInMin > 23) { - timeInMin /= 24 - unit = 'Days' - } - - if (timeInMin > 355) { - timeInMin /= 355 - unit = 'Years' - } - - return Math.round(timeInMin) + ' ' + unit + return OC.Util.relativeModifiedDate(this.card.duedate) }, card() { return this.$store.getters.cardById(this.id) From f63eef36b7aca963a811a474f1467da1c07c0933 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 16 Aug 2019 12:23:17 +0200 Subject: [PATCH 2/4] time calc all 10 secs Signed-off-by: Jakob --- src/components/card/CardSidebar.vue | 30 ++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/components/card/CardSidebar.vue b/src/components/card/CardSidebar.vue index 4d2362d7c..be16c4021 100644 --- a/src/components/card/CardSidebar.vue +++ b/src/components/card/CardSidebar.vue @@ -99,6 +99,14 @@ export default { desc: null } }, + created() { + setInterval(this.lastModifiedRelative, 10000) + setInterval(this.lastCreatedRemative, 10000) + }, + destroyed() { + clearInterval(this.lastModifiedRelative) + clearInterval(this.lastCreatedRemative) + }, computed: { ...mapState({ currentBoard: state => state.currentBoard, @@ -108,10 +116,7 @@ export default { return this.$store.getters.cardById(this.id) }, subtitle() { - let lastModified = OC.Util.relativeModifiedDate(this.currentCard.lastModified * 1000) - let createdAt = OC.Util.relativeModifiedDate(this.currentCard.createdAt * 1000) - - return t('deck', 'Modified') + ': ' + lastModified + ' ' + t('deck', 'Created') + ': ' + createdAt + return t('deck', 'Modified') + ': ' + this.lastModifiedRelative() + ' ' + t('deck', 'Created') + ': ' + this.lastCreatedRemative() }, toolbarActions() { return [ @@ -133,7 +138,7 @@ export default { } }, watch: { - 'currentCard': { + /* currentCard: { immediate: true, handler() { this.copiedCard = JSON.parse(JSON.stringify(this.currentCard)) @@ -141,13 +146,28 @@ export default { this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant) this.desc = this.currentCard.description } + }, */ + currentCard() { + this.copiedCard = JSON.parse(JSON.stringify(this.currentCard)) + this.allLabels = this.currentCard.labels + this.assignedUsers = this.currentCard.assignedUsers.map((item) => item.participant) + this.desc = this.currentCard.description + console.log("change card" + this.desc) }, + desc() { this.copiedCard.description = this.desc this.saveDesc() } }, methods: { + lastModifiedRelative() { + console.log(this.currentCard.lastModified) + return OC.Util.relativeModifiedDate(this.currentCard.lastModified * 1000) + }, + lastCreatedRemative() { + return OC.Util.relativeModifiedDate(this.currentCard.createdAt * 1000) + }, setDue() { this.$store.dispatch('updateCardDue', this.copiedCard) }, From c0a95978779a04d3448d914e05c90c535c23a5b2 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 16 Aug 2019 12:50:30 +0200 Subject: [PATCH 3/4] time calc all 10 secs and checkbox icon Signed-off-by: Jakob --- src/components/card/CardSidebar.vue | 52 +++++++++++------------- src/components/cards/CardBadges.vue | 61 +++++++++++++++++++---------- 2 files changed, 63 insertions(+), 50 deletions(-) diff --git a/src/components/card/CardSidebar.vue b/src/components/card/CardSidebar.vue index be16c4021..444ac2701 100644 --- a/src/components/card/CardSidebar.vue +++ b/src/components/card/CardSidebar.vue @@ -52,8 +52,10 @@ -