summaryrefslogtreecommitdiffstats
path: root/client/components/cards
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/cards')
-rw-r--r--client/components/cards/attachments.js9
-rw-r--r--client/components/cards/cardDate.js60
-rw-r--r--client/components/cards/cardDetails.jade53
-rw-r--r--client/components/cards/cardDetails.js2
-rw-r--r--client/components/cards/cardDetails.styl6
-rw-r--r--client/components/cards/cardTime.jade8
-rw-r--r--client/components/cards/cardTime.js19
-rw-r--r--client/components/cards/checklists.js4
-rw-r--r--client/components/cards/minicard.jade42
-rw-r--r--client/components/cards/minicard.js11
-rw-r--r--client/components/cards/minicard.styl12
-rw-r--r--client/components/cards/subtasks.js1
12 files changed, 137 insertions, 90 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js
index bc7d3979..5cac930d 100644
--- a/client/components/cards/attachments.js
+++ b/client/components/cards/attachments.js
@@ -57,8 +57,13 @@ Template.cardAttachmentsPopup.events({
const card = this;
FS.Utility.eachFile(evt, (f) => {
const file = new FS.File(f);
- file.boardId = card.boardId;
- file.cardId = card._id;
+ if (card.isLinkedCard()) {
+ file.boardId = Cards.findOne(card.linkedId).boardId;
+ file.cardId = card.linkedId;
+ } else {
+ file.boardId = card.boardId;
+ file.cardId = card._id;
+ }
file.userId = Meteor.userId();
const attachment = Attachments.insert(file);
diff --git a/client/components/cards/cardDate.js b/client/components/cards/cardDate.js
index 831a0f39..182705d5 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,14 +250,14 @@ 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' + ' ';
- const dueAt = this.data().dueAt;
- const endAt = this.data().endAt;
+ const dueAt = this.data().getDue();
+ const endAt = this.data().getEnd();
const theDate = this.date.get();
const now = this.now.get();
// if dueAt or endAt exist & are > startAt, startAt doesn't need to be flagged
@@ -288,14 +288,13 @@ 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()));
});
}
classes() {
let classes = 'due-date' + ' ';
-
- const endAt = this.data().endAt;
+ const endAt = this.data().getEnd();
const theDate = this.date.get();
const now = this.now.get();
// if the due date is after the end date, green - done early
@@ -330,19 +329,20 @@ 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' + ' ';
- const dueAt = this.data.dueAt;
+ const dueAt = this.data().getDue();
const theDate = this.date.get();
- // if dueAt exists & is after endAt, endAt doesn't need to be flagged
- if ((dueAt) && (theDate.isAfter(dueAt, 'minute')))
+ if (theDate.diff(dueAt, 'days') >= 2)
classes += 'long-overdue';
- else
- classes += 'current';
+ else if (theDate.diff(dueAt, 'days') >= 0)
+ classes += 'due';
+ else if (theDate.diff(dueAt, 'days') >= -2)
+ classes += 'almost-due';
return classes;
}
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade
index 34dbc117..4401d24b 100644
--- a/client/components/cards/cardDetails.jade
+++ b/client/components/cards/cardDetails.jade
@@ -10,7 +10,7 @@ template(name="cardDetails")
h2.card-details-title.js-card-title(
class="{{#if canModifyCard}}js-open-inlined-form is-editable{{/if}}")
+viewer
- = title
+ = getTitle
if isWatching
i.fa.fa-eye.card-details-watch
.card-details-path
@@ -19,43 +19,50 @@ template(name="cardDetails")
a.js-parent-card(href=linkForCard) {{title}}
// else
{{_ 'top-level-card'}}
+ if isLinkedCard
+ h3.linked-card-location
+ +viewer
+ | {{getBoardTitle}} > {{getTitle}}
- if archived
- p.warning {{_ 'card-archived'}}
+ if getArchived
+ if isLinkedBoard
+ p.warning {{_ 'board-archived'}}
+ else
+ p.warning {{_ 'card-archived'}}
.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-end
- h3.card-details-item-title {{_ 'card-end'}}
- if endAt
- +cardEndDate
- else
- a.js-end-date {{_ 'add'}}
-
.card-details-item.card-details-item-due
h3.card-details-item-title {{_ 'card-due'}}
- if dueAt
+ if getDue
+cardDueDate
else
a.js-due-date {{_ 'add'}}
+ .card-details-item.card-details-item-end
+ h3.card-details-item-title {{_ 'card-end'}}
+ if getEnd
+ +cardEndDate
+ else
+ a.js-end-date {{_ 'add'}}
+
.card-details-items
.card-details-item.card-details-item-members
h3.card-details-item-title {{_ 'members'}}
- each members
+ each getMembers
+userAvatar(userId=this cardId=../_id)
| {{! XXX Hack to hide syntaxic coloration /// }}
if canModifyCard
@@ -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'}}
@@ -92,15 +99,15 @@ template(name="cardDetails")
h3.card-details-item-title {{_ 'description'}}
+inlinedCardDescription(classNames="card-description js-card-description")
+editor(autofocus=true)
- | {{getUnsavedValue 'cardDescription' _id description}}
+ | {{getUnsavedValue 'cardDescription' _id getDescription}}
.edit-controls.clearfix
button.primary(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
else
a.js-open-inlined-form
- if description
+ if getDescription
+viewer
- = description
+ = getDescription
else
| {{_ 'edit'}}
if (hasUnsavedValue 'cardDescription' _id)
@@ -109,10 +116,10 @@ template(name="cardDetails")
a.js-open-inlined-form {{_ 'view-it'}}
= ' - '
a.js-close-inlined-form {{_ 'discard'}}
- else if description
+ else if getDescription
h3.card-details-item-title {{_ 'description'}}
+viewer
- = description
+ = getDescription
.card-details-items
.card-details-item.card-details-item-name
@@ -179,7 +186,7 @@ template(name="cardDetails")
template(name="editCardTitleForm")
textarea.js-edit-card-title(rows='1' autofocus)
- = title
+ = getTitle
.edit-controls.clearfix
button.primary.confirm.js-submit-edit-card-title-form(type="submit") {{_ 'save'}}
a.fa.fa-times-thin.js-close-inlined-form
@@ -230,7 +237,7 @@ template(name="moveCardPopup")
template(name="copyCardPopup")
label(for='copy-card-title') {{_ 'title'}}:
textarea#copy-card-title.minicard-composer-textarea.js-card-title(autofocus)
- = title
+ = getTitle
+boardsAndLists
template(name="copyChecklistToManyCardsPopup")
diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js
index b41bfc17..2cd399c1 100644
--- a/client/components/cards/cardDetails.js
+++ b/client/components/cards/cardDetails.js
@@ -274,7 +274,7 @@ BlazeComponent.extendComponent({
close(isReset = false) {
if (this.isOpen.get() && !isReset) {
const draft = this.getValue().trim();
- if (draft !== Cards.findOne(Session.get('currentCard')).description) {
+ if (draft !== Cards.findOne(Session.get('currentCard')).getDescription()) {
UnsavedEdits.set(this._getUnsavedEditKey(), this.getValue());
}
}
diff --git a/client/components/cards/cardDetails.styl b/client/components/cards/cardDetails.styl
index 42d27d11..1e290305 100644
--- a/client/components/cards/cardDetails.styl
+++ b/client/components/cards/cardDetails.styl
@@ -47,6 +47,12 @@
margin: 7px 0 0
padding: 0
+ .linked-card-location
+ font-style: italic
+ font-size: 1em
+ margin-bottom: 0
+ & p
+ margin-bottom: 0
form.inlined-form
margin-top: 5px
diff --git a/client/components/cards/cardTime.jade b/client/components/cards/cardTime.jade
index dcfc92f0..8af8c414 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 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..80b7fc84 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,14 @@ 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;
- },
- isOvertime() {
- return this.data().isOvertime;
+ return this.data().getSpentTime();
},
events() {
return [{
diff --git a/client/components/cards/checklists.js b/client/components/cards/checklists.js
index e014abba..5d789351 100644
--- a/client/components/cards/checklists.js
+++ b/client/components/cards/checklists.js
@@ -74,8 +74,10 @@ BlazeComponent.extendComponent({
event.preventDefault();
const textarea = this.find('textarea.js-add-checklist-item');
const title = textarea.value.trim();
- const cardId = this.currentData().cardId;
+ let cardId = this.currentData().cardId;
const card = Cards.findOne(cardId);
+ if (card.isLinked())
+ cardId = card.linkedId;
if (title) {
Checklists.insert({
diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade
index 3f7e0940..37f537db 100644
--- a/client/components/cards/minicard.jade
+++ b/client/components/cards/minicard.jade
@@ -1,5 +1,7 @@
template(name="minicard")
- .minicard
+ .minicard(
+ class="{{#if isLinkedCard}}linked-card{{/if}}"
+ class="{{#if isLinkedBoard}}linked-board{{/if}}")
if cover
.minicard-cover(style="background-image: url('{{cover.url}}');")
if labels
@@ -13,8 +15,16 @@ template(name="minicard")
if $eq 'prefix-with-parent' currentBoard.presentParentTask
.parent-prefix
| {{ parentCardName }}
+ if isLinkedBoard
+ a.js-linked-link
+ span.linked-icon.fa.fa-folder
+ else if isLinkedCard
+ a.js-linked-link
+ span.linked-icon.fa.fa-id-card
+ if getArchived
+ span.linked-icon.linked-archived.fa.fa-archive
+viewer
- | {{ title }}
+ = getTitle
if $eq 'subtext-with-full-path' currentBoard.presentParentTask
.parent-subtext
| {{ parentString ' > ' }}
@@ -23,23 +33,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
@@ -53,9 +59,9 @@ template(name="minicard")
+viewer
= trueValue
- if members
+ if getMembers
.minicard-members.js-minicard-members
- each members
+ each getMembers
+userAvatar(userId=this)
.badges
@@ -63,8 +69,8 @@ template(name="minicard")
.badge(title="{{_ 'card-comments-title' comments.count }}")
span.badge-icon.fa.fa-comment-o.badge-comment
span.badge-text= comments.count
- if description
- .badge.badge-state-image-only(title=description)
+ if getDescription
+ .badge.badge-state-image-only(title=getDescription)
span.badge-icon.fa.fa-align-left
if attachments.count
.badge
diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js
index a98b5730..da7f9e01 100644
--- a/client/components/cards/minicard.js
+++ b/client/components/cards/minicard.js
@@ -6,4 +6,15 @@ BlazeComponent.extendComponent({
template() {
return 'minicard';
},
+
+ events() {
+ return [{
+ 'click .js-linked-link' () {
+ if (this.data().isLinkedCard())
+ Utils.goCardId(this.data().linkedId);
+ else if (this.data().isLinkedBoard())
+ Utils.goBoardId(this.data().linkedId);
+ },
+ }];
+ },
}).register('minicard');
diff --git a/client/components/cards/minicard.styl b/client/components/cards/minicard.styl
index 5624787c..8fec7238 100644
--- a/client/components/cards/minicard.styl
+++ b/client/components/cards/minicard.styl
@@ -44,6 +44,16 @@
transition: transform 0.2s,
border-radius 0.2s
+ &.linked-board
+ &.linked-card
+ .linked-icon
+ display: inline-block
+ margin-right: 11px
+ vertical-align: baseline
+ font-size: 0.9em
+ .linked-archived
+ color: #937760
+
.is-selected &
transform: translateX(11px)
border-bottom-right-radius: 0
@@ -87,6 +97,8 @@
.minicard-title
p:last-child
margin-bottom: 0
+ .viewer
+ display: inline-block
.dates
display: flex;
flex-direction: row;
diff --git a/client/components/cards/subtasks.js b/client/components/cards/subtasks.js
index 9c6f265e..1651d449 100644
--- a/client/components/cards/subtasks.js
+++ b/client/components/cards/subtasks.js
@@ -29,6 +29,7 @@ BlazeComponent.extendComponent({
boardId: targetBoard._id,
sort: sortIndex,
swimlaneId,
+ type: 'cardType-card',
});
// In case the filter is active we need to add the newly inserted card in