summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/components/activities/comments.js11
-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
-rw-r--r--client/components/forms/forms.styl3
-rw-r--r--client/components/lists/list.styl11
-rw-r--r--client/components/lists/listBody.jade54
-rw-r--r--client/components/lists/listBody.js201
-rw-r--r--client/components/users/userAvatar.js5
-rw-r--r--client/lib/filter.js251
19 files changed, 541 insertions, 222 deletions
diff --git a/client/components/activities/comments.js b/client/components/activities/comments.js
index 9b6aedd6..34b6402c 100644
--- a/client/components/activities/comments.js
+++ b/client/components/activities/comments.js
@@ -21,11 +21,18 @@ BlazeComponent.extendComponent({
'submit .js-new-comment-form'(evt) {
const input = this.getInput();
const text = input.val().trim();
+ const card = this.currentData();
+ let boardId = card.boardId;
+ let cardId = card._id;
+ if (card.isLinkedCard()) {
+ boardId = Cards.findOne(card.linkedId).boardId;
+ cardId = card.linkedId;
+ }
if (text) {
CardComments.insert({
text,
- boardId: this.currentData().boardId,
- cardId: this.currentData()._id,
+ boardId,
+ cardId,
});
resetCommentInput(input);
Tracker.flush();
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
diff --git a/client/components/forms/forms.styl b/client/components/forms/forms.styl
index 0a905943..5be70b7a 100644
--- a/client/components/forms/forms.styl
+++ b/client/components/forms/forms.styl
@@ -225,9 +225,12 @@ textarea
.edit-controls,
.add-controls
+ display: flex
+ align-items: baseline
margin-top: 0
button[type=submit]
+ input[type=button]
float: left
height: 32px
margin-top: -2px
diff --git a/client/components/lists/list.styl b/client/components/lists/list.styl
index fa32ff6d..72cb19f4 100644
--- a/client/components/lists/list.styl
+++ b/client/components/lists/list.styl
@@ -187,3 +187,14 @@
padding: 7px
top: -@padding
right: 17px
+
+.link-board-wrapper
+ display: flex
+ align-items: baseline
+
+ .js-link-board
+ margin-left: 15px
+
+.search-card-results
+ max-height: 250px
+ overflow: hidden
diff --git a/client/components/lists/listBody.jade b/client/components/lists/listBody.jade
index 32c6b278..8069717e 100644
--- a/client/components/lists/listBody.jade
+++ b/client/components/lists/listBody.jade
@@ -34,8 +34,60 @@ template(name="addCardForm")
.add-controls.clearfix
button.primary.confirm(type="submit") {{_ 'add'}}
- a.fa.fa-times-thin.js-close-inlined-form
+ span.quiet
+ | {{_ 'or'}}
+ a.js-link {{_ 'link'}}
+ span.quiet
+ |  
+ | /
+ a.js-search {{_ 'search'}}
template(name="autocompleteLabelLine")
.minicard-label(class="card-label-{{colorName}}" title=labelName)
span(class="{{#if hasNoName}}quiet{{/if}}")= labelName
+
+template(name="linkCardPopup")
+ label {{_ 'boards'}}:
+ .link-board-wrapper
+ select.js-select-boards
+ each boards
+ if $eq _id currentBoard._id
+ option(value="{{_id}}" selected) {{_ 'current'}}
+ else
+ option(value="{{_id}}") {{title}}
+ input.primary.confirm.js-link-board(type="button" value="{{_ 'link'}}")
+
+ label {{_ 'swimlanes'}}:
+ select.js-select-swimlanes
+ each swimlanes
+ option(value="{{_id}}") {{title}}
+
+ label {{_ 'lists'}}:
+ select.js-select-lists
+ each lists
+ option(value="{{_id}}") {{title}}
+
+ label {{_ 'cards'}}:
+ select.js-select-cards
+ each cards
+ option(value="{{_id}}") {{title}}
+
+ .edit-controls.clearfix
+ input.primary.confirm.js-done(type="button" value="{{_ 'link'}}")
+
+template(name="searchCardPopup")
+ label {{_ 'boards'}}:
+ .link-board-wrapper
+ select.js-select-boards
+ each boards
+ if $eq _id currentBoard._id
+ option(value="{{_id}}" selected) {{_ 'current'}}
+ else
+ option(value="{{_id}}") {{title}}
+ form.js-search-term-form
+ input(type="text" name="searchTerm" placeholder="{{_ 'search-example'}}" autofocus)
+ .list-body.js-perfect-scrollbar.search-card-results
+ .minicards.clearfix.js-minicards
+ each results
+ a.minicard-wrapper.js-minicard
+ +minicard(this)
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 0a10f7d5..83592a64 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -1,3 +1,5 @@
+const subManager = new SubsManager();
+
BlazeComponent.extendComponent({
mixins() {
return [Mixins.PerfectScrollbar];
@@ -55,6 +57,7 @@ BlazeComponent.extendComponent({
boardId: boardId._id,
sort: sortIndex,
swimlaneId,
+ type: 'cardType-card',
});
// In case the filter is active we need to add the newly inserted card in
// the list of exceptions -- cards that are not filtered. Otherwise the
@@ -197,6 +200,8 @@ BlazeComponent.extendComponent({
events() {
return [{
keydown: this.pressKey,
+ 'click .js-link': Popup.open('linkCard'),
+ 'click .js-search': Popup.open('searchCard'),
}];
},
@@ -268,3 +273,199 @@ BlazeComponent.extendComponent({
});
},
}).register('addCardForm');
+
+BlazeComponent.extendComponent({
+ onCreated() {
+ // Prefetch first non-current board id
+ const boardId = Boards.findOne({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ _id: {$ne: Session.get('currentBoard')},
+ }, {
+ sort: ['title'],
+ })._id;
+ // Subscribe to this board
+ subManager.subscribe('board', boardId);
+ this.selectedBoardId = new ReactiveVar(boardId);
+ this.selectedSwimlaneId = new ReactiveVar('');
+ this.selectedListId = new ReactiveVar('');
+
+ this.boardId = Session.get('currentBoard');
+ // In order to get current board info
+ subManager.subscribe('board', this.boardId);
+ this.board = Boards.findOne(this.boardId);
+ // List where to insert card
+ const list = $(Popup._getTopStack().openerElement).closest('.js-list');
+ this.listId = Blaze.getData(list[0])._id;
+ // Swimlane where to insert card
+ const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane');
+ this.swimlaneId = '';
+ const boardView = Meteor.user().profile.boardView;
+ if (boardView === 'board-view-swimlanes')
+ this.swimlaneId = Blaze.getData(swimlane[0])._id;
+ else if (boardView === 'board-view-lists')
+ this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
+ },
+
+ boards() {
+ const boards = Boards.find({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ _id: {$ne: Session.get('currentBoard')},
+ }, {
+ sort: ['title'],
+ });
+ return boards;
+ },
+
+ swimlanes() {
+ const swimlanes = Swimlanes.find({boardId: this.selectedBoardId.get()});
+ if (swimlanes.count())
+ this.selectedSwimlaneId.set(swimlanes.fetch()[0]._id);
+ return swimlanes;
+ },
+
+ lists() {
+ const lists = Lists.find({boardId: this.selectedBoardId.get()});
+ if (lists.count())
+ this.selectedListId.set(lists.fetch()[0]._id);
+ return lists;
+ },
+
+ cards() {
+ return Cards.find({
+ boardId: this.selectedBoardId.get(),
+ swimlaneId: this.selectedSwimlaneId.get(),
+ listId: this.selectedListId.get(),
+ archived: false,
+ linkedId: null,
+ _id: {$nin: this.board.cards().map((card) => { return card.linkedId || card._id; })},
+ });
+ },
+
+ events() {
+ return [{
+ 'change .js-select-boards'(evt) {
+ this.selectedBoardId.set($(evt.currentTarget).val());
+ subManager.subscribe('board', this.selectedBoardId.get());
+ },
+ 'change .js-select-swimlanes'(evt) {
+ this.selectedSwimlaneId.set($(evt.currentTarget).val());
+ },
+ 'change .js-select-lists'(evt) {
+ this.selectedListId.set($(evt.currentTarget).val());
+ },
+ 'click .js-done' (evt) {
+ // LINK CARD
+ evt.stopPropagation();
+ evt.preventDefault();
+ const _id = Cards.insert({
+ title: $('.js-select-cards option:selected').text(), //dummy
+ listId: this.listId,
+ swimlaneId: this.swimlaneId,
+ boardId: this.boardId,
+ sort: Lists.findOne(this.listId).cards().count(),
+ type: 'cardType-linkedCard',
+ linkedId: $('.js-select-cards option:selected').val(),
+ });
+ Filter.addException(_id);
+ Popup.close();
+ },
+ 'click .js-link-board' (evt) {
+ //LINK BOARD
+ evt.stopPropagation();
+ evt.preventDefault();
+ const impBoardId = $('.js-select-boards option:selected').val();
+ const _id = Cards.insert({
+ title: $('.js-select-boards option:selected').text(), //dummy
+ listId: this.listId,
+ swimlaneId: this.swimlaneId,
+ boardId: this.boardId,
+ sort: Lists.findOne(this.listId).cards().count(),
+ type: 'cardType-linkedBoard',
+ linkedId: impBoardId,
+ });
+ Filter.addException(_id);
+ Popup.close();
+ },
+ }];
+ },
+}).register('linkCardPopup');
+
+BlazeComponent.extendComponent({
+ mixins() {
+ return [Mixins.PerfectScrollbar];
+ },
+
+ onCreated() {
+ // Prefetch first non-current board id
+ const boardId = Boards.findOne({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ _id: {$ne: Session.get('currentBoard')},
+ })._id;
+ // Subscribe to this board
+ subManager.subscribe('board', boardId);
+ this.selectedBoardId = new ReactiveVar(boardId);
+
+ this.boardId = Session.get('currentBoard');
+ // In order to get current board info
+ subManager.subscribe('board', this.boardId);
+ const board = Boards.findOne(this.boardId);
+ // List where to insert card
+ const list = $(Popup._getTopStack().openerElement).closest('.js-list');
+ this.listId = Blaze.getData(list[0])._id;
+ // Swimlane where to insert card
+ const swimlane = $(Popup._getTopStack().openerElement).closest('.js-swimlane');
+ this.swimlaneId = '';
+ if (board.view === 'board-view-swimlanes')
+ this.swimlaneId = Blaze.getData(swimlane[0])._id;
+ else
+ this.swimlaneId = Swimlanes.findOne({boardId: this.boardId})._id;
+ this.term = new ReactiveVar('');
+ },
+
+ boards() {
+ const boards = Boards.find({
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ _id: {$ne: Session.get('currentBoard')},
+ }, {
+ sort: ['title'],
+ });
+ return boards;
+ },
+
+ results() {
+ const board = Boards.findOne(this.selectedBoardId.get());
+ return board.searchCards(this.term.get(), true);
+ },
+
+ events() {
+ return [{
+ 'change .js-select-boards'(evt) {
+ this.selectedBoardId.set($(evt.currentTarget).val());
+ subManager.subscribe('board', this.selectedBoardId.get());
+ },
+ 'submit .js-search-term-form'(evt) {
+ evt.preventDefault();
+ this.term.set(evt.target.searchTerm.value);
+ },
+ 'click .js-minicard'(evt) {
+ // LINK CARD
+ const card = Blaze.getData(evt.currentTarget);
+ const _id = Cards.insert({
+ title: card.title, //dummy
+ listId: this.listId,
+ swimlaneId: this.swimlaneId,
+ boardId: this.boardId,
+ sort: Lists.findOne(this.listId).cards().count(),
+ type: 'cardType-linkedCard',
+ linkedId: card._id,
+ });
+ Filter.addException(_id);
+ Popup.close();
+ },
+ }];
+ },
+}).register('searchCardPopup');
diff --git a/client/components/users/userAvatar.js b/client/components/users/userAvatar.js
index be7a85d2..91cad237 100644
--- a/client/components/users/userAvatar.js
+++ b/client/components/users/userAvatar.js
@@ -134,8 +134,9 @@ BlazeComponent.extendComponent({
Template.cardMembersPopup.helpers({
isCardMember() {
- const cardId = Template.parentData()._id;
- const cardMembers = Cards.findOne(cardId).members || [];
+ const card = Template.parentData();
+ const cardMembers = card.getMembers();
+
return _.contains(cardMembers, this.userId);
},
diff --git a/client/lib/filter.js b/client/lib/filter.js
index a4e58692..26140ca6 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -187,27 +187,27 @@ class AdvancedFilter {
if (commands[i].cmd) {
switch (commands[i].cmd) {
case '(':
- {
- level++;
- if (start === -1) start = i;
- continue;
- }
+ {
+ level++;
+ if (start === -1) start = i;
+ continue;
+ }
case ')':
- {
- level--;
- commands.splice(i, 1);
- i--;
- continue;
- }
- default:
- {
- if (level > 0) {
- subcommands.push(commands[i]);
+ {
+ level--;
commands.splice(i, 1);
i--;
continue;
}
- }
+ default:
+ {
+ if (level > 0) {
+ subcommands.push(commands[i]);
+ commands.splice(i, 1);
+ i--;
+ continue;
+ }
+ }
}
}
}
@@ -229,113 +229,112 @@ class AdvancedFilter {
case '=':
case '==':
case '===':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- if (commands[i + 1].regex)
{
- const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
- let regex = null;
- if (match.length > 2)
- regex = new RegExp(match[1], match[2]);
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ if (commands[i + 1].regex)
+ {
+ const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
+ let regex = null;
+ if (match.length > 2)
+ regex = new RegExp(match[1], match[2]);
+ else
+ regex = new RegExp(match[1]);
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': regex };
+ }
else
- regex = new RegExp(match[1]);
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': regex };
- }
- else
- {
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
+ {
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
+ }
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
}
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
case '!=':
case '!==':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- if (commands[i + 1].regex)
{
- const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
- let regex = null;
- if (match.length > 2)
- regex = new RegExp(match[1], match[2]);
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ if (commands[i + 1].regex)
+ {
+ const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
+ let regex = null;
+ if (match.length > 2)
+ regex = new RegExp(match[1], match[2]);
+ else
+ regex = new RegExp(match[1]);
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: regex } };
+ }
else
- regex = new RegExp(match[1]);
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: regex } };
- }
- else
- {
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
+ {
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
+ }
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
}
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
case '>':
case 'gt':
case 'Gt':
case 'GT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '>=':
case '>==':
case 'gte':
case 'Gte':
case 'GTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '<':
case 'lt':
case 'Lt':
case 'LT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '<=':
case '<==':
case 'lte':
case 'Lte':
case 'LTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
-
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
}
}
}
@@ -350,45 +349,43 @@ class AdvancedFilter {
case 'OR':
case '|':
case '||':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $or: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $or: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case 'and':
case 'And':
case 'AND':
case '&':
case '&&':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $and: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
-
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $and: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case 'not':
case 'Not':
case 'NOT':
case '!':
- {
- const op1 = commands[i + 1];
- commands[i] = { $not: op1 };
- commands.splice(i + 1, 1);
- //changed = true;
- i--;
- break;
- }
-
+ {
+ const op1 = commands[i + 1];
+ commands[i] = { $not: op1 };
+ commands.splice(i + 1, 1);
+ //changed = true;
+ i--;
+ break;
+ }
}
}
}