diff options
author | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-28 17:00:35 +0300 |
---|---|---|
committer | Nicu Tofan <nicu.tofan@gmail.com> | 2018-06-28 17:00:35 +0300 |
commit | 3eba6ef2856946925795f9cd370583be892344dd (patch) | |
tree | 11d3bb19678153f955647fbf4b3f6d2299933d7d /client/components/cards | |
parent | b7d508e8c4cf858559e144053d119ceaebfa9697 (diff) | |
parent | ad54a8a48404a84b0bf5ff7dab5348be6dda574e (diff) | |
download | wekan-3eba6ef2856946925795f9cd370583be892344dd.tar.gz wekan-3eba6ef2856946925795f9cd370583be892344dd.tar.bz2 wekan-3eba6ef2856946925795f9cd370583be892344dd.zip |
Merge branch 'devel' into nested-tasks
Diffstat (limited to 'client/components/cards')
-rw-r--r-- | client/components/cards/cardDate.js | 57 | ||||
-rw-r--r-- | client/components/cards/minicard.styl | 4 |
2 files changed, 38 insertions, 23 deletions
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js index c3e0524d..02ea09ae 100644 --- a/client/components/cards/cardDate.js +++ b/client/components/cards/cardDate.js @@ -218,10 +218,13 @@ class CardReceivedDate extends CardDate { } classes() { - let classes = 'received-date' + ' '; - if (this.date.get().isBefore(this.now.get(), 'minute') && - this.now.get().isBefore(this.data().dueAt)) { - classes += 'current'; + let classes = 'received-date '; + const dueAt = this.data().dueAt; + if (dueAt) { + if (this.date.get().isBefore(this.now.get(), 'minute') && + this.now.get().isBefore(dueAt)) { + classes += 'current'; + } } return classes; } @@ -249,9 +252,12 @@ class CardStartDate extends CardDate { classes() { let classes = 'start-date' + ' '; - if (this.date.get().isBefore(this.now.get(), 'minute') && - this.now.get().isBefore(this.data().dueAt)) { - classes += 'current'; + const dueAt = this.data().dueAt; + if (dueAt) { + if (this.date.get().isBefore(this.now.get(), 'minute') && + this.now.get().isBefore(dueAt)) { + classes += 'current'; + } } return classes; } @@ -279,18 +285,23 @@ class CardDueDate extends CardDate { classes() { let classes = 'due-date' + ' '; + // if endAt exists & is < dueAt, dueAt doesn't need to be flagged - if ((this.data().endAt !== 0) && - (this.data().endAt !== null) && - (this.data().endAt !== '') && - (this.data().endAt !== undefined) && - (this.date.get().isBefore(this.data().endAt))) + const endAt = this.data().endAt; + const theDate = this.date.get(); + const now = this.now.get(); + + if ((endAt !== 0) && + (endAt !== null) && + (endAt !== '') && + (endAt !== undefined) && + (theDate.isBefore(endAt))) classes += 'current'; - else if (this.now.get().diff(this.date.get(), 'days') >= 2) + else if (now.diff(theDate, 'days') >= 2) classes += 'long-overdue'; - else if (this.now.get().diff(this.date.get(), 'minute') >= 0) + else if (now.diff(theDate, 'minute') >= 0) classes += 'due'; - else if (this.now.get().diff(this.date.get(), 'days') >= -1) + else if (now.diff(theDate, 'days') >= -1) classes += 'almost-due'; return classes; } @@ -318,12 +329,16 @@ class CardEndDate extends CardDate { classes() { let classes = 'end-date' + ' '; - if (this.data.dueAt.diff(this.date.get(), 'days') >= 2) - classes += 'long-overdue'; - else if (this.data.dueAt.diff(this.date.get(), 'days') > 0) - classes += 'due'; - else if (this.data.dueAt.diff(this.date.get(), 'days') <= 0) - classes += 'current'; + const dueAt = this.data.dueAt; + if (dueAt) { + const diff = dueAt.diff(this.date.get(), 'days'); + if (diff >= 2) + classes += 'long-overdue'; + else if (diff > 0) + classes += 'due'; + else if (diff <= 0) + classes += 'current'; + } return classes; } diff --git a/client/components/cards/minicard.styl b/client/components/cards/minicard.styl index 6c9414a7..90429dff 100644 --- a/client/components/cards/minicard.styl +++ b/client/components/cards/minicard.styl @@ -5,7 +5,7 @@ position: relative display: flex align-items: center - margin-bottom: 9px + margin-bottom: 2px &.placeholder background: darken(white, 20%) @@ -37,7 +37,7 @@ flex-wrap: wrap background-color: #fff min-height: 20px - box-shadow: 0 1px 2px rgba(0,0,0,.15) + box-shadow: 0 0px 16px rgba(0,0,0,0.15) inset border-radius: 2px color: #4d4d4d overflow: hidden |