diff --git a/client/components/cards/cardDate.jade b/client/components/cards/cardDate.jade index 2e4475067..9bcc67f2f 100644 --- a/client/components/cards/cardDate.jade +++ b/client/components/cards/cardDate.jade @@ -8,3 +8,7 @@ template(name="dateBadge") time(datetime="{{showISODate}}") | {{showDate}} +template(name="dateCustomField") + a(title="{{showTitle}}" class="{{classes}}") + time(datetime="{{showISODate}}") + | {{showDate}} diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js index 9b2268e9e..aa73439bd 100644 --- a/client/components/cards/cardDate.js +++ b/client/components/cards/cardDate.js @@ -363,6 +363,33 @@ class CardEndDate extends CardDate { } CardEndDate.register('cardEndDate'); +class CardCustomFieldDate extends CardDate { + template() { + return 'dateCustomField'; + } + + onCreated() { + super.onCreated(); + const self = this; + self.autorun(() => { + self.date.set(moment(self.data().value)); + }); + } + + classes() { + return 'customfield-date'; + } + + showTitle() { + return ''; + } + + events() { + return []; + } +} +CardCustomFieldDate.register('cardCustomFieldDate'); + (class extends CardReceivedDate { showDate() { return this.date.get().format('l'); @@ -387,6 +414,12 @@ CardEndDate.register('cardEndDate'); } }.register('minicardEndDate')); +(class extends CardCustomFieldDate { + showDate() { + return this.date.get().format('l'); + } +}.register('minicardCustomFieldDate')); + class VoteEndDate extends CardDate { onCreated() { super.onCreated(); diff --git a/client/components/cards/cardDate.styl b/client/components/cards/cardDate.styl index 62cfdcd96..617d11bb6 100644 --- a/client/components/cards/cardDate.styl +++ b/client/components/cards/cardDate.styl @@ -2,11 +2,11 @@ display: block border-radius: 4px padding: 1px 3px - + background-color: #dbdbdb &:hover, &.is-active background-color: #b3b3b3 - + &.current, &.almost-due, &.due, &.long-overdue color: #fff @@ -14,17 +14,17 @@ background-color: #5ba639 &:hover, &.is-active background-color: darken(#5ba639, 10) - + &.almost-due background-color: #edc909 &:hover, &.is-active background-color: darken(#edc909, 10) - + &.due background-color: #fa3f00 &:hover, &.is-active background-color: darken(#fa3f00, 10) - + &.long-overdue background-color: #fd5d47 &:hover, &.is-active @@ -57,3 +57,7 @@ -webkit-font-smoothing: antialiased margin-right: 0.3em +.customfield-date + display: block + border-radius: 4px + padding: 1px 3px diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index 0a282dd7e..09276a676 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -77,6 +77,9 @@ template(name="minicard") if $eq definition.type "currency" +viewer = formattedCurrencyCustomFieldValue(definition) + else if $eq definition.type "date" + .date + +minicardCustomFieldDate else +viewer = trueValue