summaryrefslogtreecommitdiffstats
path: root/client/components/cards
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2018-04-17 23:17:44 -0300
committerAndrés Manelli <andresmanelli@gmail.com>2018-08-11 00:07:29 +0200
commit724d26379c33afc2c3d44d3722b0c5c35c1b80ed (patch)
tree7678c5b0769bda94ea2237451989e8c7ece3f637 /client/components/cards
parent0a62089df02b2ab308d4749a837e08c4164cb770 (diff)
downloadwekan-724d26379c33afc2c3d44d3722b0c5c35c1b80ed.tar.gz
wekan-724d26379c33afc2c3d44d3722b0c5c35c1b80ed.tar.bz2
wekan-724d26379c33afc2c3d44d3722b0c5c35c1b80ed.zip
Add two way binding of card/board times
Diffstat (limited to 'client/components/cards')
-rw-r--r--client/components/cards/cardDate.js56
-rw-r--r--client/components/cards/cardDetails.jade17
-rw-r--r--client/components/cards/cardTime.jade8
-rw-r--r--client/components/cards/cardTime.js18
-rw-r--r--client/components/cards/minicard.jade20
5 files changed, 68 insertions, 51 deletions
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 831a0f39..aa0dca4c 100644
--- a/client/components/cards/cardDate.js
+++ b/client/components/cards/cardDate.js
@@ -96,7 +96,7 @@ Template.dateBadge.helpers({
(class extends DatePicker {
onCreated() {
super.onCreated();
- this.data().receivedAt && this.date.set(moment(this.data().receivedAt));
+ this.data().getReceived() && this.date.set(moment(this.data().getReceived()));
}
_storeDate(date) {
@@ -104,7 +104,7 @@ Template.dateBadge.helpers({
}
_deleteDate() {
- this.card.unsetReceived();
+ this.card.setReceived(null);
}
}).register('editCardReceivedDatePopup');
@@ -113,13 +113,13 @@ Template.dateBadge.helpers({
(class extends DatePicker {
onCreated() {
super.onCreated();
- this.data().startAt && this.date.set(moment(this.data().startAt));
+ this.data().getStart() && this.date.set(moment(this.data().getStart()));
}
onRendered() {
super.onRendered();
- if (moment.isDate(this.card.receivedAt)) {
- this.$('.js-datepicker').datepicker('setStartDate', this.card.receivedAt);
+ if (moment.isDate(this.card.getReceived())) {
+ this.$('.js-datepicker').datepicker('setStartDate', this.card.getReceived());
}
}
@@ -128,7 +128,7 @@ Template.dateBadge.helpers({
}
_deleteDate() {
- this.card.unsetStart();
+ this.card.setStart(null);
}
}).register('editCardStartDatePopup');
@@ -136,13 +136,13 @@ Template.dateBadge.helpers({
(class extends DatePicker {
onCreated() {
super.onCreated();
- this.data().dueAt && this.date.set(moment(this.data().dueAt));
+ this.data().getDue() && this.date.set(moment(this.data().getDue()));
}
onRendered() {
super.onRendered();
- if (moment.isDate(this.card.startAt)) {
- this.$('.js-datepicker').datepicker('setStartDate', this.card.startAt);
+ if (moment.isDate(this.card.getStart())) {
+ this.$('.js-datepicker').datepicker('setStartDate', this.card.getStart());
}
}
@@ -151,7 +151,7 @@ Template.dateBadge.helpers({
}
_deleteDate() {
- this.card.unsetDue();
+ this.card.setDue(null);
}
}).register('editCardDueDatePopup');
@@ -159,13 +159,13 @@ Template.dateBadge.helpers({
(class extends DatePicker {
onCreated() {
super.onCreated();
- this.data().endAt && this.date.set(moment(this.data().endAt));
+ this.data().getEnd() && this.date.set(moment(this.data().getEnd()));
}
onRendered() {
super.onRendered();
- if (moment.isDate(this.card.startAt)) {
- this.$('.js-datepicker').datepicker('setStartDate', this.card.startAt);
+ if (moment.isDate(this.card.getStart())) {
+ this.$('.js-datepicker').datepicker('setStartDate', this.card.getStart());
}
}
@@ -174,7 +174,7 @@ Template.dateBadge.helpers({
}
_deleteDate() {
- this.card.unsetEnd();
+ this.card.setEnd(null);
}
}).register('editCardEndDatePopup');
@@ -213,15 +213,15 @@ class CardReceivedDate extends CardDate {
super.onCreated();
const self = this;
self.autorun(() => {
- self.date.set(moment(self.data().receivedAt));
+ self.date.set(moment(self.data().getReceived()));
});
}
classes() {
let classes = 'received-date ';
- const dueAt = this.data().dueAt;
- const endAt = this.data().endAt;
- const startAt = this.data().startAt;
+ const dueAt = this.data().getDue();
+ const endAt = this.data().getEnd();
+ const startAt = this.data().getStart();
const theDate = this.date.get();
// if dueAt, endAt and startAt exist & are > receivedAt, receivedAt doesn't need to be flagged
if (((startAt) && (theDate.isAfter(dueAt))) ||
@@ -250,12 +250,13 @@ class CardStartDate extends CardDate {
super.onCreated();
const self = this;
self.autorun(() => {
- self.date.set(moment(self.data().startAt));
+ self.date.set(moment(self.data().getStart()));
});
}
classes() {
let classes = 'start-date' + ' ';
+<<<<<<< HEAD
const dueAt = this.data().dueAt;
const endAt = this.data().endAt;
const theDate = this.date.get();
@@ -267,6 +268,10 @@ class CardStartDate extends CardDate {
else if (theDate.isBefore(now, 'minute'))
classes += 'almost-due';
else
+=======
+ if (this.date.get().isBefore(this.now.get(), 'minute') &&
+ this.now.get().isBefore(this.data().getDue())) {
+>>>>>>> Add two way binding of card/board times
classes += 'current';
return classes;
}
@@ -288,7 +293,7 @@ class CardDueDate extends CardDate {
super.onCreated();
const self = this;
self.autorun(() => {
- self.date.set(moment(self.data().dueAt));
+ self.date.set(moment(self.data().getDue()));
});
}
@@ -330,12 +335,13 @@ class CardEndDate extends CardDate {
super.onCreated();
const self = this;
self.autorun(() => {
- self.date.set(moment(self.data().endAt));
+ self.date.set(moment(self.data().getEnd()));
});
}
classes() {
let classes = 'end-date' + ' ';
+<<<<<<< HEAD
const dueAt = this.data.dueAt;
const theDate = this.date.get();
// if dueAt exists & is after endAt, endAt doesn't need to be flagged
@@ -343,6 +349,14 @@ class CardEndDate extends CardDate {
classes += 'long-overdue';
else
classes += 'current';
+=======
+ if (this.date.get().diff(this.data().getDue(), 'days') >= 2)
+ classes += 'long-overdue';
+ else if (this.date.get().diff(this.data().getDue(), 'days') >= 0)
+ classes += 'due';
+ else if (this.date.get().diff(this.data().getDue(), 'days') >= -2)
+ classes += 'almost-due';
+>>>>>>> Add two way binding of card/board times
return classes;
}
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index 64ce7f66..b8c16f80 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -26,21 +26,28 @@ template(name="cardDetails")
.card-details-items
.card-details-item.card-details-item-received
h3.card-details-item-title {{_ 'card-received'}}
- if receivedAt
+ if getReceived
+cardReceivedDate
else
a.js-received-date {{_ 'add'}}
.card-details-item.card-details-item-start
h3.card-details-item-title {{_ 'card-start'}}
- if startAt
+ if getStart
+cardStartDate
else
a.js-start-date {{_ 'add'}}
+ .card-details-item.card-details-item-due
+ h3.card-details-item-title {{_ 'card-due'}}
+ if getDue
+ +cardDueDate
+ else
+ a.js-due-date {{_ 'add'}}
+
.card-details-item.card-details-item-end
h3.card-details-item-title {{_ 'card-end'}}
- if endAt
+ if getEnd
+cardEndDate
else
a.js-end-date {{_ 'add'}}
@@ -79,9 +86,9 @@ template(name="cardDetails")
+cardCustomField
.card-details-items
- if spentTime
+ if getSpentTime
.card-details-item.card-details-item-spent
- if isOvertime
+ if getIsOvertime
h3.card-details-item-title {{_ 'overtime-hours'}}
else
h3.card-details-item-title {{_ 'spent-time-hours'}}
diff --git a/client/components/cards/cardTime.jade b/client/components/cards/cardTime.jade
index dcfc92f0..041af65a 100644
--- a/client/components/cards/cardTime.jade
+++ b/client/components/cards/cardTime.jade
@@ -3,10 +3,10 @@ template(name="editCardSpentTime")
form.edit-time
.fields
label(for="time") {{_ 'time'}}
- input.js-time-field#time(type="number" step="0.01" name="time" value="{{card.spentTime}}" placeholder=timeFormat autofocus)
+ input.js-time-field#time(type="number" step="0.01" name="time" value="{{card.getSpentTime}}" placeholder=timeFormat autofocus)
label(for="overtime") {{_ 'overtime'}}
a.js-toggle-overtime
- .materialCheckBox#overtime(class="{{#if card.isOvertime}}is-checked{{/if}}" name="overtime")
+ .materialCheckBox#overtime(class="{{#if card.getIsOvertime}}is-checked{{/if}}" name="overtime")
if error.get
.warning {{_ error.get}}
@@ -15,8 +15,8 @@ template(name="editCardSpentTime")
template(name="timeBadge")
if canModifyCard
- a.js-edit-time.card-time(title="{{showTitle}}" class="{{#if isOvertime}}card-label-red{{else}}card-label-green{{/if}}")
+ a.js-edit-time.card-time(title="{{showTitle}}" class="{{#if getIsOvertime}}card-label-red{{else}}card-label-green{{/if}}")
| {{showTime}}
else
- a.card-time(title="{{showTitle}}" class="{{#if isOvertime}}card-label-red{{else}}card-label-green{{/if}}")
+ a.card-time(title="{{showTitle}}" class="{{#if getIsOvertime}}card-label-red{{else}}card-label-green{{/if}}")
| {{showTime}}
diff --git a/client/components/cards/cardTime.js b/client/components/cards/cardTime.js
index eadcc88e..9bab8e72 100644
--- a/client/components/cards/cardTime.js
+++ b/client/components/cards/cardTime.js
@@ -7,17 +7,17 @@ BlazeComponent.extendComponent({
this.card = this.data();
},
toggleOvertime() {
- this.card.isOvertime = !this.card.isOvertime;
+ this.card.setIsOvertime(!this.card.getIsOvertime());
$('#overtime .materialCheckBox').toggleClass('is-checked');
$('#overtime').toggleClass('is-checked');
},
storeTime(spentTime, isOvertime) {
this.card.setSpentTime(spentTime);
- this.card.setOvertime(isOvertime);
+ this.card.setIsOvertime(isOvertime);
},
deleteTime() {
- this.card.unsetSpentTime();
+ this.card.setSpentTime(null);
},
events() {
return [{
@@ -26,7 +26,7 @@ BlazeComponent.extendComponent({
evt.preventDefault();
const spentTime = parseFloat(evt.target.time.value);
- const isOvertime = this.card.isOvertime;
+ const isOvertime = this.card.getIsOvertime();
if (spentTime >= 0) {
this.storeTime(spentTime, isOvertime);
@@ -55,17 +55,17 @@ BlazeComponent.extendComponent({
self.time = ReactiveVar();
},
showTitle() {
- if (this.data().isOvertime) {
- return `${TAPi18n.__('overtime')} ${this.data().spentTime} ${TAPi18n.__('hours')}`;
+ if (this.data().getIsOvertime()) {
+ return `${TAPi18n.__('overtime')} ${this.data().getSpentTime()} ${TAPi18n.__('hours')}`;
} else {
- return `${TAPi18n.__('card-spent')} ${this.data().spentTime} ${TAPi18n.__('hours')}`;
+ return `${TAPi18n.__('card-spent')} ${this.data().getSpentTime()} ${TAPi18n.__('hours')}`;
}
},
showTime() {
- return this.data().spentTime;
+ return this.data().getSpentTime();
},
isOvertime() {
- return this.data().isOvertime;
+ return this.data().getIsOvertime();
},
events() {
return [{
diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade
index 00120882..88ad5564 100644
--- a/client/components/cards/minicard.jade
+++ b/client/components/cards/minicard.jade
@@ -27,23 +27,19 @@ template(name="minicard")
| {{ parentCardName }}
.dates
- if receivedAt
- unless startAt
- unless dueAt
- unless endAt
+ if getReceived
+ unless getStart
+ unless getDue
+ unless getEnd
.date
+minicardReceivedDate
- if startAt
+ if getStart
.date
+minicardStartDate
- if dueAt
- unless endAt
- .date
- +minicardDueDate
- if endAt
+ if getDue
.date
- +minicardEndDate
- if spentTime
+ +minicardDueDate
+ if getSpentTime
.date
+cardSpentTime