mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
- Revert IFTTT.
Thanks to xet7 !
This commit is contained in:
parent
338e18870f
commit
5445955a77
54 changed files with 127 additions and 2821 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,13 +1,3 @@
|
|||
# v1.47 2018-09-16 Wekan release
|
||||
|
||||
This release adds the following new features:
|
||||
|
||||
- [IFTTT Rules](https://github.com/wekan/wekan/pull/1896). Useful to automate things like
|
||||
[adding labels, members, moving card, archiving them, checking checklists etc](https://github.com/wekan/wekan/issues/1160).
|
||||
Please test and report bugs. Later colors need to be made translatable.
|
||||
|
||||
Thanks to GitHub users Angtrim and xet7 for their contributions.
|
||||
|
||||
# v1.46 2018-09-15 Wekan release
|
||||
|
||||
This release adds the following new features:
|
||||
|
|
|
@ -14,9 +14,6 @@ template(name="boardActivities")
|
|||
p.activity-desc
|
||||
+memberName(user=user)
|
||||
|
||||
if($eq activityType 'deleteAttachment')
|
||||
| {{{_ 'activity-delete-attach' cardLink}}}.
|
||||
|
||||
if($eq activityType 'addAttachment')
|
||||
| {{{_ 'activity-attached' attachmentLink cardLink}}}.
|
||||
|
||||
|
@ -34,28 +31,12 @@ template(name="boardActivities")
|
|||
.activity-checklist(href="{{ card.absoluteUrl }}")
|
||||
+viewer
|
||||
= checklist.title
|
||||
if($eq activityType 'removeChecklist')
|
||||
| {{{_ 'activity-checklist-removed' cardLink}}}.
|
||||
|
||||
if($eq activityType 'checkedItem')
|
||||
| {{{_ 'activity-checked-item' checkItem checklist.title cardLink}}}.
|
||||
|
||||
if($eq activityType 'uncheckedItem')
|
||||
| {{{_ 'activity-unchecked-item' checkItem checklist.title cardLink}}}.
|
||||
|
||||
if($eq activityType 'checklistCompleted')
|
||||
| {{{_ 'activity-checklist-completed' checklist.title cardLink}}}.
|
||||
|
||||
if($eq activityType 'checklistUncompleted')
|
||||
| {{{_ 'activity-checklist-uncompleted' checklist.title cardLink}}}.
|
||||
|
||||
if($eq activityType 'addChecklistItem')
|
||||
| {{{_ 'activity-checklist-item-added' checklist.title cardLink}}}.
|
||||
.activity-checklist(href="{{ card.absoluteUrl }}")
|
||||
+viewer
|
||||
= checklistItem.title
|
||||
if($eq activityType 'removedChecklistItem')
|
||||
| {{{_ 'activity-checklist-item-removed' checklist.title cardLink}}}.
|
||||
|
||||
if($eq activityType 'archivedCard')
|
||||
| {{{_ 'activity-archived' cardLink}}}.
|
||||
|
@ -108,12 +89,6 @@ template(name="boardActivities")
|
|||
if($eq activityType 'restoredCard')
|
||||
| {{{_ 'activity-sent' cardLink boardLabel}}}.
|
||||
|
||||
if($eq activityType 'addedLabel')
|
||||
| {{{_ 'activity-added-label' lastLabel cardLink}}}.
|
||||
|
||||
if($eq activityType 'removedLabel')
|
||||
| {{{_ 'activity-removed-label' lastLabel cardLink}}}.
|
||||
|
||||
if($eq activityType 'unjoinMember')
|
||||
if($eq user._id member._id)
|
||||
| {{{_ 'activity-unjoined' cardLink}}}.
|
||||
|
@ -144,28 +119,6 @@ template(name="cardActivities")
|
|||
| {{{_ 'activity-removed' cardLabel memberLink}}}.
|
||||
if($eq activityType 'archivedCard')
|
||||
| {{_ 'activity-archived' cardLabel}}.
|
||||
|
||||
if($eq activityType 'addedLabel')
|
||||
| {{{_ 'activity-added-label-card' lastLabel }}}.
|
||||
|
||||
if($eq activityType 'removedLabel')
|
||||
| {{{_ 'activity-removed-label-card' lastLabel }}}.
|
||||
|
||||
if($eq activityType 'removeChecklist')
|
||||
| {{{_ 'activity-checklist-removed' cardLabel}}}.
|
||||
|
||||
if($eq activityType 'checkedItem')
|
||||
| {{{_ 'activity-checked-item-card' checkItem checklist.title }}}.
|
||||
|
||||
if($eq activityType 'uncheckedItem')
|
||||
| {{{_ 'activity-unchecked-item-card' checkItem checklist.title }}}.
|
||||
|
||||
if($eq activityType 'checklistCompleted')
|
||||
| {{{_ 'activity-checklist-completed-card' checklist.title }}}.
|
||||
|
||||
if($eq activityType 'checklistUncompleted')
|
||||
| {{{_ 'activity-checklist-uncompleted-card' checklist.title }}}.
|
||||
|
||||
if($eq activityType 'restoredCard')
|
||||
| {{_ 'activity-sent' cardLabel boardLabel}}.
|
||||
if($eq activityType 'moveCard')
|
||||
|
@ -174,10 +127,6 @@ template(name="cardActivities")
|
|||
| {{{_ 'activity-attached' attachmentLink cardLabel}}}.
|
||||
if attachment.isImage
|
||||
img.attachment-image-preview(src=attachment.url)
|
||||
if($eq activityType 'deleteAttachment')
|
||||
| {{{_ 'activity-delete-attach' cardLabel}}}.
|
||||
if($eq activityType 'removedChecklist')
|
||||
| {{{_ 'activity-checklist-removed' cardLabel}}}.
|
||||
if($eq activityType 'addChecklist')
|
||||
| {{{_ 'activity-checklist-added' cardLabel}}}.
|
||||
.activity-checklist
|
||||
|
|
|
@ -50,12 +50,6 @@ BlazeComponent.extendComponent({
|
|||
}
|
||||
},
|
||||
|
||||
checkItem(){
|
||||
const checkItemId = this.currentData().checklistItemId;
|
||||
const checkItem = ChecklistItems.findOne({_id:checkItemId});
|
||||
return checkItem.title;
|
||||
},
|
||||
|
||||
boardLabel() {
|
||||
return TAPi18n.__('this-board');
|
||||
},
|
||||
|
@ -72,16 +66,6 @@ BlazeComponent.extendComponent({
|
|||
}, card.title));
|
||||
},
|
||||
|
||||
lastLabel(){
|
||||
const lastLabelId = this.currentData().labelId;
|
||||
const lastLabel = Boards.findOne(Session.get('currentBoard')).getLabelById(lastLabelId);
|
||||
if(lastLabel.name === undefined || lastLabel.name === ''){
|
||||
return lastLabel.color;
|
||||
}else{
|
||||
return lastLabel.name;
|
||||
}
|
||||
},
|
||||
|
||||
listLabel() {
|
||||
return this.currentData().list().title;
|
||||
},
|
||||
|
|
|
@ -88,10 +88,6 @@ template(name="boardHeaderBar")
|
|||
a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}")
|
||||
i.fa.fa-times-thin
|
||||
|
||||
a.board-header-btn.js-open-rules-view(title="{{_ 'rules'}}")
|
||||
i.fa.fa-magic
|
||||
span {{_ 'rules'}}
|
||||
|
||||
a.board-header-btn.js-open-search-view(title="{{_ 'search'}}")
|
||||
i.fa.fa-search
|
||||
span {{_ 'search'}}
|
||||
|
@ -294,11 +290,6 @@ template(name="boardChangeTitlePopup")
|
|||
textarea.js-board-desc= description
|
||||
input.primary.wide(type="submit" value="{{_ 'rename'}}")
|
||||
|
||||
template(name="boardCreateRulePopup")
|
||||
p {{_ 'close-board-pop'}}
|
||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||
|
||||
|
||||
template(name="archiveBoardPopup")
|
||||
p {{_ 'close-board-pop'}}
|
||||
button.js-confirm.negate.full(type="submit") {{_ 'archive'}}
|
||||
|
|
|
@ -108,9 +108,6 @@ BlazeComponent.extendComponent({
|
|||
'click .js-open-search-view'() {
|
||||
Sidebar.setView('search');
|
||||
},
|
||||
'click .js-open-rules-view'() {
|
||||
Modal.openWide('rulesMain');
|
||||
},
|
||||
'click .js-multiselection-activate'() {
|
||||
const currentCard = Session.get('currentCard');
|
||||
MultiSelection.activate();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
@import 'nib'
|
||||
|
||||
select,
|
||||
textarea,
|
||||
input:not([type=file]),
|
||||
button
|
||||
|
|
|
@ -36,18 +36,11 @@ template(name="defaultLayout")
|
|||
if (Modal.isOpen)
|
||||
#modal
|
||||
.overlay
|
||||
if (Modal.isWide)
|
||||
.modal-content-wide.modal-container
|
||||
a.modal-close-btn.js-close-modal
|
||||
i.fa.fa-times-thin
|
||||
+Template.dynamic(template=Modal.getHeaderName)
|
||||
+Template.dynamic(template=Modal.getTemplateName)
|
||||
else
|
||||
.modal-content.modal-container
|
||||
a.modal-close-btn.js-close-modal
|
||||
i.fa.fa-times-thin
|
||||
+Template.dynamic(template=Modal.getHeaderName)
|
||||
+Template.dynamic(template=Modal.getTemplateName)
|
||||
.modal-content
|
||||
a.modal-close-btn.js-close-modal
|
||||
i.fa.fa-times-thin
|
||||
+Template.dynamic(template=Modal.getHeaderName)
|
||||
+Template.dynamic(template=Modal.getTemplateName)
|
||||
|
||||
template(name="notFound")
|
||||
+message(label='page-not-found')
|
||||
|
|
|
@ -61,23 +61,6 @@ body
|
|||
display: block
|
||||
float: right
|
||||
font-size: 24px
|
||||
|
||||
.modal-content-wide
|
||||
width: 800px
|
||||
min-height: 0px
|
||||
margin: 42px auto
|
||||
padding: 12px
|
||||
border-radius: 4px
|
||||
background: darken(white, 13%)
|
||||
z-index: 110
|
||||
|
||||
h2
|
||||
margin-bottom: 25px
|
||||
|
||||
.modal-close-btn
|
||||
display: block
|
||||
float: right
|
||||
font-size: 24px
|
||||
|
||||
h1
|
||||
font-size: 22px
|
||||
|
|
BIN
client/components/rules/.DS_Store
vendored
BIN
client/components/rules/.DS_Store
vendored
Binary file not shown.
|
@ -1,46 +0,0 @@
|
|||
template(name="boardActions")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-move-card-to'}}
|
||||
div.trigger-dropdown
|
||||
select(id="move-gen-action")
|
||||
option(value="top") {{_'r-top-of'}}
|
||||
option(value="bottom") {{_'r-bottom-of'}}
|
||||
div.trigger-text
|
||||
| {{_'r-its-list'}}
|
||||
div.trigger-button.js-add-gen-move-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-move-card-to'}}
|
||||
div.trigger-dropdown
|
||||
select(id="move-spec-action")
|
||||
option(value="top") {{_'r-top-of'}}
|
||||
option(value="bottom") {{_'r-bottom-of'}}
|
||||
div.trigger-text
|
||||
| {{_'r-list'}}
|
||||
div.trigger-dropdown
|
||||
input(id="listName",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-button.js-add-spec-move-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="arch-action")
|
||||
option(value="archive") {{_'r-archive'}}
|
||||
option(value="unarchive") {{_'r-unarchive'}}
|
||||
div.trigger-text
|
||||
| {{_'r-card'}}
|
||||
div.trigger-button.js-add-arch-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-spec-move-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#move-spec-action').value;
|
||||
const listTitle = this.find('#listName').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'top') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'moveCardToTop',
|
||||
listTitle,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'bottom') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'moveCardToBottom',
|
||||
listTitle,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-move-action' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const boardId = Session.get('currentBoard');
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#move-gen-action').value;
|
||||
if (actionSelected === 'top') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'moveCardToTop',
|
||||
'listTitle': '*',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'bottom') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'moveCardToBottom',
|
||||
'listTitle': '*',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-arch-action' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const boardId = Session.get('currentBoard');
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#arch-action').value;
|
||||
if (actionSelected === 'archive') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'archive',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'unarchive') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'unarchive',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('boardActions');
|
||||
/* eslint-no-undef */
|
|
@ -1,43 +0,0 @@
|
|||
template(name="cardActions")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="label-action")
|
||||
option(value="add") {{{_'r-add'}}}
|
||||
option(value="remove") {{{_'r-remove'}}}
|
||||
div.trigger-text
|
||||
| {{{_'r-label'}}}
|
||||
div.trigger-dropdown
|
||||
select(id="label-id")
|
||||
each labels
|
||||
option(value="#{_id}")
|
||||
= name
|
||||
div.trigger-button.js-add-label-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="member-action")
|
||||
option(value="add") {{{_'r-add'}}}
|
||||
option(value="remove") {{{_'r-remove'}}}
|
||||
div.trigger-text
|
||||
| {{{_'r-member'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="member-name",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-button.js-add-member-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{{_'r-remove-all'}}}
|
||||
div.trigger-button.js-add-removeall-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
|
||||
labels() {
|
||||
const labels = Boards.findOne(Session.get('currentBoard')).labels;
|
||||
for (let i = 0; i < labels.length; i++) {
|
||||
if (labels[i].name === '' || labels[i].name === undefined) {
|
||||
labels[i].name = labels[i].color.toUpperCase();
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-label-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#label-action').value;
|
||||
const labelId = this.find('#label-id').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'add') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'addLabel',
|
||||
labelId,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'remove') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'removeLabel',
|
||||
labelId,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
'click .js-add-member-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#member-action').value;
|
||||
const memberName = this.find('#member-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'add') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'addMember',
|
||||
memberName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'remove') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'removeMember',
|
||||
memberName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-removeall-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const boardId = Session.get('currentBoard');
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'removeMember',
|
||||
'memberName': '*',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('cardActions');
|
|
@ -1,51 +0,0 @@
|
|||
template(name="checklistActions")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="check-action")
|
||||
option(value="add") {{{_'r-add'}}}
|
||||
option(value="remove") {{{_'r-remove'}}}
|
||||
div.trigger-text
|
||||
| {{{_'r-checklist'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checklist-name",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-button.js-add-checklist-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="checkall-action")
|
||||
option(value="check") {{{_'r-check-all'}}}
|
||||
option(value="uncheck") {{{_'r-uncheck-all'}}}
|
||||
div.trigger-text
|
||||
| {{{_'r-items-check'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checklist-name2",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-button.js-add-checkall-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-dropdown
|
||||
select(id="check-item-action")
|
||||
option(value="check") {{{_'r-check'}}}
|
||||
option(value="uncheck") {{{_'r-uncheck'}}}
|
||||
div.trigger-text
|
||||
| {{{_'r-item'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checkitem-name",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-text
|
||||
| {{{_'r-of-checklist'}}}
|
||||
div.trigger-dropdown
|
||||
input(id="checklist-name3",type=text,placeholder="{{{_'r-name'}}}")
|
||||
div.trigger-button.js-add-check-item-action.js-goto-rules
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-checklist-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#check-action').value;
|
||||
const checklistName = this.find('#checklist-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'add') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'addChecklist',
|
||||
checklistName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'remove') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'removeChecklist',
|
||||
checklistName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
'click .js-add-checkall-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const actionSelected = this.find('#checkall-action').value;
|
||||
const checklistName = this.find('#checklist-name2').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'check') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'checkAll',
|
||||
checklistName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'uncheck') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'uncheckAll',
|
||||
checklistName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-check-item-action' (event) {
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const checkItemName = this.find('#checkitem-name');
|
||||
const checklistName = this.find('#checklist-name3');
|
||||
const actionSelected = this.find('#check-item-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
if (actionSelected === 'check') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'checkItem',
|
||||
checklistName,
|
||||
checkItemName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'uncheck') {
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'uncheckItem',
|
||||
checklistName,
|
||||
checkItemName,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('checklistActions');
|
|
@ -1,11 +0,0 @@
|
|||
template(name="mailActions")
|
||||
div.trigger-item.trigger-item-mail
|
||||
div.trigger-content.trigger-content-mail
|
||||
div.trigger-text.trigger-text-email
|
||||
| {{_'r-send-email'}}
|
||||
div.trigger-dropdown-mail
|
||||
input(id="email-to",type=text,placeholder="{{_'r-to'}}")
|
||||
input(id="email-subject",type=text,placeholder="{{_'r-subject'}}")
|
||||
textarea(id="email-msg")
|
||||
div.trigger-button.trigger-button-email.js-mail-action.js-goto-rules
|
||||
i.fa.fa-plus
|
|
@ -1,35 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-mail-action' (event) {
|
||||
const emailTo = this.find('#email-to').value;
|
||||
const emailSubject = this.find('#email-subject').value;
|
||||
const emailMsg = this.find('#email-msg').value;
|
||||
const trigger = this.data().triggerVar.get();
|
||||
const ruleName = this.data().ruleName.get();
|
||||
const triggerId = Triggers.insert(trigger);
|
||||
const boardId = Session.get('currentBoard');
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const actionId = Actions.insert({
|
||||
actionType: 'sendEmail',
|
||||
emailTo,
|
||||
emailSubject,
|
||||
emailMsg,
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
Rules.insert({
|
||||
title: ruleName,
|
||||
triggerId,
|
||||
actionId,
|
||||
boardId,
|
||||
});
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('mailActions');
|
|
@ -1,18 +0,0 @@
|
|||
template(name="ruleDetails")
|
||||
.rules
|
||||
h2
|
||||
i.fa.fa-magic
|
||||
| {{{_ 'r-rule-details' }}}
|
||||
.triggers-content
|
||||
.triggers-body
|
||||
.triggers-main-body
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
= trigger
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
= action
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
this.subscribe('allTriggers');
|
||||
this.subscribe('allActions');
|
||||
|
||||
},
|
||||
|
||||
trigger() {
|
||||
const ruleId = this.data().ruleId;
|
||||
const rule = Rules.findOne({
|
||||
_id: ruleId.get(),
|
||||
});
|
||||
const trigger = Triggers.findOne({
|
||||
_id: rule.triggerId,
|
||||
});
|
||||
return trigger.description();
|
||||
},
|
||||
action() {
|
||||
const ruleId = this.data().ruleId;
|
||||
const rule = Rules.findOne({
|
||||
_id: ruleId.get(),
|
||||
});
|
||||
const action = Actions.findOne({
|
||||
_id: rule.actionId,
|
||||
});
|
||||
return action.description();
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{}];
|
||||
},
|
||||
|
||||
}).register('ruleDetails');
|
|
@ -1,156 +0,0 @@
|
|||
.rules-list
|
||||
overflow:hidden
|
||||
overflow-y:scroll
|
||||
max-height: 400px
|
||||
.rules-lists-item
|
||||
display: block
|
||||
position: relative
|
||||
overflow: auto
|
||||
p
|
||||
display: inline-block
|
||||
float: left
|
||||
margin: revert
|
||||
|
||||
.rules-btns-group
|
||||
position: absolute
|
||||
right: 0
|
||||
top: 50%
|
||||
transform: translateY(-50%)
|
||||
button
|
||||
margin: auto
|
||||
.rules-add
|
||||
display: block
|
||||
overflow: auto
|
||||
margin-top: 15px
|
||||
margin-bottom: 5px
|
||||
input
|
||||
display: inline-block
|
||||
float: right
|
||||
margin: auto
|
||||
margin-right: 10px
|
||||
button
|
||||
display: inline-block
|
||||
float: right
|
||||
margin: auto
|
||||
.flex
|
||||
display: -webkit-box
|
||||
display: -moz-box
|
||||
display: -webkit-flex
|
||||
display: -moz-flex
|
||||
display: -ms-flexbox
|
||||
display: flex
|
||||
|
||||
|
||||
|
||||
.triggers-content
|
||||
color: #727479
|
||||
background: #dedede
|
||||
.triggers-body
|
||||
display flex
|
||||
padding-top 15px
|
||||
height 100%
|
||||
|
||||
.triggers-side-menu
|
||||
background-color: #f7f7f7
|
||||
border: 1px solid #f0f0f0
|
||||
border-radius: 4px
|
||||
height: intrinsic
|
||||
box-shadow: inset -1px -1px 3px rgba(0,0,0,.05)
|
||||
|
||||
ul
|
||||
|
||||
li
|
||||
margin: 0.1rem 0.2rem;
|
||||
width:50px
|
||||
height:50px
|
||||
text-align:center
|
||||
font-size: 25px
|
||||
position: relative
|
||||
|
||||
i
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
box-shadow: none
|
||||
transform: translate(-50%,-50%);
|
||||
|
||||
|
||||
&.active
|
||||
background #fff
|
||||
box-shadow 0 1px 2px rgba(0,0,0,0.15);
|
||||
|
||||
&:hover
|
||||
background #fff
|
||||
box-shadow 0 1px 2px rgba(0,0,0,0.15);
|
||||
a
|
||||
@extends .flex
|
||||
padding: 1rem 0 1rem 1rem
|
||||
width: 100% - 5rem
|
||||
|
||||
|
||||
span
|
||||
font-size: 13px
|
||||
.triggers-main-body
|
||||
padding: 0.1em 1em
|
||||
width:100%
|
||||
.trigger-item
|
||||
overflow:auto
|
||||
padding:10px
|
||||
height:40px
|
||||
margin-bottom:5px
|
||||
border-radius: 3px
|
||||
position: relative
|
||||
background-color: white
|
||||
.trigger-content
|
||||
position:absolute
|
||||
top:50%
|
||||
transform: translateY(-50%)
|
||||
left:10px
|
||||
.trigger-text
|
||||
font-size: 16px
|
||||
display:inline-block
|
||||
.trigger-text.trigger-text-email
|
||||
margin-left: 5px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
.trigger-dropdown
|
||||
display:inline-block
|
||||
select
|
||||
width:100px
|
||||
height:30px
|
||||
margin:0px
|
||||
margin-left:5px
|
||||
input
|
||||
display: inline-block
|
||||
width: 80px;
|
||||
margin: 0;
|
||||
.trigger-content-mail
|
||||
left:20px
|
||||
right:100px
|
||||
.trigger-button
|
||||
position:absolute
|
||||
top:50%
|
||||
transform: translateY(-50%)
|
||||
width:30px
|
||||
height:30px
|
||||
border: 1px solid #eee
|
||||
border-radius: 4px
|
||||
box-shadow: inset -1px -1px 3px rgba(0,0,0,.05)
|
||||
text-align:center
|
||||
font-size: 20px
|
||||
right:10px
|
||||
i
|
||||
position: absolute
|
||||
top: 50%
|
||||
left: 50%
|
||||
box-shadow: none
|
||||
transform: translate(-50%,-50%)
|
||||
&:hover, &.is-active
|
||||
box-shadow: 0 0 0 2px darken(white, 60%) inset
|
||||
.trigger-button.trigger-button-email
|
||||
top:30px
|
||||
.trigger-item.trigger-item-mail
|
||||
height:300px
|
||||
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
template(name="rulesActions")
|
||||
h2
|
||||
i.fa.fa-magic
|
||||
| {{{_ 'r-rule' }}} "#{data.ruleName.get}" - {{{_ 'r-add-action'}}}
|
||||
.triggers-content
|
||||
.triggers-body
|
||||
.triggers-side-menu
|
||||
ul
|
||||
li.active.js-set-board-actions
|
||||
i.fa.fa-columns
|
||||
li.js-set-card-actions
|
||||
i.fa.fa-sticky-note
|
||||
li.js-set-checklist-actions
|
||||
i.fa.fa-check
|
||||
li.js-set-mail-actions
|
||||
i.fa.fa-at
|
||||
.triggers-main-body
|
||||
if ($eq currentActions.get 'board')
|
||||
+boardActions(ruleName=data.ruleName triggerVar=data.triggerVar)
|
||||
else if ($eq currentActions.get 'card')
|
||||
+cardActions(ruleName=data.ruleName triggerVar=data.triggerVar)
|
||||
else if ($eq currentActions.get 'checklist')
|
||||
+checklistActions(ruleName=data.ruleName triggerVar=data.triggerVar)
|
||||
else if ($eq currentActions.get 'mail')
|
||||
+mailActions(ruleName=data.ruleName triggerVar=data.triggerVar)
|
|
@ -1,58 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.currentActions = new ReactiveVar('board');
|
||||
},
|
||||
|
||||
setBoardActions() {
|
||||
this.currentActions.set('board');
|
||||
$('.js-set-card-actions').removeClass('active');
|
||||
$('.js-set-board-actions').addClass('active');
|
||||
$('.js-set-checklist-actions').removeClass('active');
|
||||
$('.js-set-mail-actions').removeClass('active');
|
||||
},
|
||||
setCardActions() {
|
||||
this.currentActions.set('card');
|
||||
$('.js-set-card-actions').addClass('active');
|
||||
$('.js-set-board-actions').removeClass('active');
|
||||
$('.js-set-checklist-actions').removeClass('active');
|
||||
$('.js-set-mail-actions').removeClass('active');
|
||||
},
|
||||
setChecklistActions() {
|
||||
this.currentActions.set('checklist');
|
||||
$('.js-set-card-actions').removeClass('active');
|
||||
$('.js-set-board-actions').removeClass('active');
|
||||
$('.js-set-checklist-actions').addClass('active');
|
||||
$('.js-set-mail-actions').removeClass('active');
|
||||
},
|
||||
setMailActions() {
|
||||
this.currentActions.set('mail');
|
||||
$('.js-set-card-actions').removeClass('active');
|
||||
$('.js-set-board-actions').removeClass('active');
|
||||
$('.js-set-checklist-actions').removeClass('active');
|
||||
$('.js-set-mail-actions').addClass('active');
|
||||
},
|
||||
|
||||
rules() {
|
||||
return Rules.find({});
|
||||
},
|
||||
|
||||
name() {
|
||||
// console.log(this.data());
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-set-board-actions' (event) {
|
||||
this.setBoardActions();
|
||||
},
|
||||
'click .js-set-card-actions' (event) {
|
||||
this.setCardActions();
|
||||
},
|
||||
'click .js-set-mail-actions' (event) {
|
||||
this.setMailActions();
|
||||
},
|
||||
'click .js-set-checklist-actions' (event) {
|
||||
this.setChecklistActions();
|
||||
},
|
||||
}];
|
||||
},
|
||||
}).register('rulesActions');
|
|
@ -1,27 +0,0 @@
|
|||
template(name="rulesList")
|
||||
.rules
|
||||
h2
|
||||
i.fa.fa-magic
|
||||
| {{{_ 'r-board-rules' }}}
|
||||
|
||||
ul.rules-list
|
||||
each rules
|
||||
li.rules-lists-item
|
||||
p
|
||||
= title
|
||||
div.rules-btns-group
|
||||
button.js-goto-details
|
||||
i.fa.fa-eye
|
||||
| {{{_ 'r-view-rule'}}}
|
||||
if currentUser.isAdmin
|
||||
button.js-delete-rule
|
||||
i.fa.fa-trash-o
|
||||
| {{{_ 'r-delete-rule'}}}
|
||||
else
|
||||
li.no-items-message {{{_ 'r-no-rules' }}}
|
||||
if currentUser.isAdmin
|
||||
div.rules-add
|
||||
button.js-goto-trigger
|
||||
i.fa.fa-plus
|
||||
| {{{_ 'r-add-rule'}}}
|
||||
input(type=text,placeholder="{{{_ 'r-new-rule-name' }}}",id="ruleTitle")
|
|
@ -1,15 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
|
||||
rules() {
|
||||
const boardId = Session.get('currentBoard');
|
||||
return Rules.find({
|
||||
boardId,
|
||||
});
|
||||
},
|
||||
events() {
|
||||
return [{}];
|
||||
},
|
||||
}).register('rulesList');
|
|
@ -1,9 +0,0 @@
|
|||
template(name="rulesMain")
|
||||
if($eq rulesCurrentTab.get 'rulesList')
|
||||
+rulesList
|
||||
if($eq rulesCurrentTab.get 'trigger')
|
||||
+rulesTriggers(ruleName=ruleName triggerVar=triggerVar)
|
||||
if($eq rulesCurrentTab.get 'action')
|
||||
+rulesActions(ruleName=ruleName triggerVar=triggerVar)
|
||||
if($eq rulesCurrentTab.get 'ruleDetails')
|
||||
+ruleDetails(ruleId=ruleId)
|
|
@ -1,59 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.rulesCurrentTab = new ReactiveVar('rulesList');
|
||||
this.ruleName = new ReactiveVar('');
|
||||
this.triggerVar = new ReactiveVar();
|
||||
this.ruleId = new ReactiveVar();
|
||||
},
|
||||
|
||||
setTrigger() {
|
||||
this.rulesCurrentTab.set('trigger');
|
||||
},
|
||||
|
||||
setRulesList() {
|
||||
this.rulesCurrentTab.set('rulesList');
|
||||
},
|
||||
|
||||
setAction() {
|
||||
this.rulesCurrentTab.set('action');
|
||||
},
|
||||
|
||||
setRuleDetails() {
|
||||
this.rulesCurrentTab.set('ruleDetails');
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-delete-rule' (event) {
|
||||
const rule = this.currentData();
|
||||
Rules.remove(rule._id);
|
||||
Actions.remove(rule.actionId);
|
||||
Triggers.remove(rule.triggerId);
|
||||
|
||||
},
|
||||
'click .js-goto-trigger' (event) {
|
||||
event.preventDefault();
|
||||
const ruleTitle = this.find('#ruleTitle').value;
|
||||
this.find('#ruleTitle').value = '';
|
||||
this.ruleName.set(ruleTitle);
|
||||
this.setTrigger();
|
||||
},
|
||||
'click .js-goto-action' (event) {
|
||||
event.preventDefault();
|
||||
this.setAction();
|
||||
},
|
||||
'click .js-goto-rules' (event) {
|
||||
event.preventDefault();
|
||||
this.setRulesList();
|
||||
},
|
||||
'click .js-goto-details' (event) {
|
||||
event.preventDefault();
|
||||
const rule = this.currentData();
|
||||
this.ruleId.set(rule._id);
|
||||
this.setRuleDetails();
|
||||
},
|
||||
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('rulesMain');
|
|
@ -1,21 +0,0 @@
|
|||
template(name="rulesTriggers")
|
||||
h2
|
||||
i.fa.fa-magic
|
||||
| {{{_ 'r-rule' }}} "#{data.ruleName.get}" - {{{_ 'r-add-trigger'}}}
|
||||
.triggers-content
|
||||
.triggers-body
|
||||
.triggers-side-menu
|
||||
ul
|
||||
li.active.js-set-board-triggers
|
||||
i.fa.fa-columns
|
||||
li.js-set-card-triggers
|
||||
i.fa.fa-sticky-note
|
||||
li.js-set-checklist-triggers
|
||||
i.fa.fa-check
|
||||
.triggers-main-body
|
||||
if showBoardTrigger.get
|
||||
+boardTriggers
|
||||
else if showCardTrigger.get
|
||||
+cardTriggers
|
||||
else if showChecklistTrigger.get
|
||||
+checklistTriggers
|
|
@ -1,53 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.showBoardTrigger = new ReactiveVar(true);
|
||||
this.showCardTrigger = new ReactiveVar(false);
|
||||
this.showChecklistTrigger = new ReactiveVar(false);
|
||||
},
|
||||
|
||||
setBoardTriggers() {
|
||||
this.showBoardTrigger.set(true);
|
||||
this.showCardTrigger.set(false);
|
||||
this.showChecklistTrigger.set(false);
|
||||
$('.js-set-card-triggers').removeClass('active');
|
||||
$('.js-set-board-triggers').addClass('active');
|
||||
$('.js-set-checklist-triggers').removeClass('active');
|
||||
},
|
||||
setCardTriggers() {
|
||||
this.showBoardTrigger.set(false);
|
||||
this.showCardTrigger.set(true);
|
||||
this.showChecklistTrigger.set(false);
|
||||
$('.js-set-card-triggers').addClass('active');
|
||||
$('.js-set-board-triggers').removeClass('active');
|
||||
$('.js-set-checklist-triggers').removeClass('active');
|
||||
},
|
||||
setChecklistTriggers() {
|
||||
this.showBoardTrigger.set(false);
|
||||
this.showCardTrigger.set(false);
|
||||
this.showChecklistTrigger.set(true);
|
||||
$('.js-set-card-triggers').removeClass('active');
|
||||
$('.js-set-board-triggers').removeClass('active');
|
||||
$('.js-set-checklist-triggers').addClass('active');
|
||||
},
|
||||
|
||||
rules() {
|
||||
return Rules.find({});
|
||||
},
|
||||
|
||||
name() {
|
||||
// console.log(this.data());
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-set-board-triggers' (event) {
|
||||
this.setBoardTriggers();
|
||||
},
|
||||
'click .js-set-card-triggers' (event) {
|
||||
this.setCardTriggers();
|
||||
},
|
||||
'click .js-set-checklist-triggers' (event) {
|
||||
this.setChecklistTriggers();
|
||||
},
|
||||
}];
|
||||
},
|
||||
}).register('rulesTriggers');
|
|
@ -1,61 +0,0 @@
|
|||
template(name="boardTriggers")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-card-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="gen-action")
|
||||
option(value="created") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-the-board'}}
|
||||
div.trigger-button.js-add-gen-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-card-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
option(value="created") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-list'}}
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="{{_'r-list-name'}}")
|
||||
div.trigger-button.js-add-create-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-card-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="move-action")
|
||||
option(value="moved-to") {{_'r-moved-to'}}
|
||||
option(value="moved-from") {{_'r-moved-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-list'}}
|
||||
div.trigger-dropdown
|
||||
input(id="move-list-name",type=text,placeholder="{{_'r-list-name'}}")
|
||||
div.trigger-button.js-add-moved-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-card-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="arch-action")
|
||||
option(value="archived") {{_'r-archived'}}
|
||||
option(value="unarchived") {{_'r-unarchived'}}
|
||||
div.trigger-button.js-add-arch-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
|
||||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-gen-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#gen-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'created') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'createCard',
|
||||
boardId,
|
||||
'listName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removeCard',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
'click .js-add-create-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#create-action').value;
|
||||
const listName = this.find('#create-list-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'created') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'createCard',
|
||||
boardId,
|
||||
listName,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removeCard',
|
||||
boardId,
|
||||
listName,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-moved-trigger' (event) {
|
||||
const datas = this.data();
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
|
||||
const actionSelected = this.find('#move-action').value;
|
||||
const listName = this.find('#move-list-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'moved-to') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'moveCard',
|
||||
boardId,
|
||||
listName,
|
||||
'oldListName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'moved-from') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'moveCard',
|
||||
boardId,
|
||||
'listName': '*',
|
||||
'oldListName': listName,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-arc-trigger' (event) {
|
||||
const datas = this.data();
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const actionSelected = this.find('#arch-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'archived') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'archivedCard',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'unarchived') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'restoredCard',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('boardTriggers');
|
|
@ -1,79 +0,0 @@
|
|||
template(name="cardTriggers")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-label-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="label-action")
|
||||
option(value="added") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-gen-label-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-the-label-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="spec-label")
|
||||
each labels
|
||||
option(value="#{_id}")
|
||||
= name
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="spec-label-action")
|
||||
option(value="added") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-spec-label-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-member'}}
|
||||
div.trigger-dropdown
|
||||
select(id="gen-member-action")
|
||||
option(value="added") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-gen-member-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-the-member'}}
|
||||
div.trigger-dropdown
|
||||
input(id="spec-member",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="spec-member-action")
|
||||
option(value="added") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-spec-member-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-attach'}}
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="attach-action")
|
||||
option(value="added") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-attachment-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
|
@ -1,128 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
labels() {
|
||||
const labels = Boards.findOne(Session.get('currentBoard')).labels;
|
||||
for (let i = 0; i < labels.length; i++) {
|
||||
if (labels[i].name === '' || labels[i].name === undefined) {
|
||||
labels[i].name = labels[i].color.toUpperCase();
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-gen-label-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#label-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'addedLabel',
|
||||
boardId,
|
||||
'labelId': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removedLabel',
|
||||
boardId,
|
||||
'labelId': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-label-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#spec-label-action').value;
|
||||
const labelId = this.find('#spec-label').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'addedLabel',
|
||||
boardId,
|
||||
labelId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removedLabel',
|
||||
boardId,
|
||||
labelId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-member-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#gen-member-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'joinMember',
|
||||
boardId,
|
||||
'memberId': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'unjoinMember',
|
||||
boardId,
|
||||
'memberId': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-member-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#spec-member-action').value;
|
||||
const memberId = this.find('#spec-member').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'joinMember',
|
||||
boardId,
|
||||
memberId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'unjoinMember',
|
||||
boardId,
|
||||
memberId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-attachment-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#attach-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'addAttachment',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'deleteAttachment',
|
||||
boardId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
}).register('cardTriggers');
|
|
@ -1,83 +0,0 @@
|
|||
template(name="checklistTriggers")
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-checklist'}}
|
||||
div.trigger-dropdown
|
||||
select(id="gen-check-action")
|
||||
option(value="created") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-gen-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-the-checklist'}}
|
||||
div.trigger-dropdown
|
||||
input(id="check-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="spec-check-action")
|
||||
option(value="created") {{_'r-added-to'}}
|
||||
option(value="removed") {{_'r-removed-from'}}
|
||||
div.trigger-text
|
||||
| {{_'r-a-card'}}
|
||||
div.trigger-button.js-add-spec-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-checklist'}}
|
||||
div.trigger-dropdown
|
||||
select(id="gen-comp-check-action")
|
||||
option(value="completed") {{_'r-completed'}}
|
||||
option(value="uncompleted") {{_'r-made-incomplete'}}
|
||||
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-the-checklist'}}
|
||||
div.trigger-dropdown
|
||||
input(id="spec-comp-check-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="spec-comp-check-action")
|
||||
option(value="completed") {{_'r-completed'}}
|
||||
option(value="uncompleted") {{_'r-made-incomplete'}}
|
||||
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-a-item'}}
|
||||
div.trigger-dropdown
|
||||
select(id="check-item-gen-action")
|
||||
option(value="checked") {{_'r-checked'}}
|
||||
option(value="unchecked") {{_'r-unchecked'}}
|
||||
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| {{_'r-when-the-item'}}
|
||||
div.trigger-dropdown
|
||||
input(id="check-item-name",type=text,placeholder="{{_'r-name'}}")
|
||||
div.trigger-text
|
||||
| {{_'r-is'}}
|
||||
div.trigger-dropdown
|
||||
select(id="check-item-spec-action")
|
||||
option(value="checked") {{_'r-checked'}}
|
||||
option(value="unchecked") {{_'r-unchecked'}}
|
||||
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
|
@ -1,146 +0,0 @@
|
|||
BlazeComponent.extendComponent({
|
||||
onCreated() {
|
||||
this.subscribe('allRules');
|
||||
},
|
||||
events() {
|
||||
return [{
|
||||
'click .js-add-gen-check-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#gen-check-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'created') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'addChecklist',
|
||||
boardId,
|
||||
'checklistName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removeChecklist',
|
||||
boardId,
|
||||
'checklistName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-check-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#spec-check-action').value;
|
||||
const checklistId = this.find('#check-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'created') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'addChecklist',
|
||||
boardId,
|
||||
'checklistName': checklistId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'removeChecklist',
|
||||
boardId,
|
||||
'checklistName': checklistId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-comp-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#gen-comp-check-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'completed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'completeChecklist',
|
||||
boardId,
|
||||
'checklistName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'uncompleted') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'uncompleteChecklist',
|
||||
boardId,
|
||||
'checklistName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-comp-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#spec-comp-check-action').value;
|
||||
const checklistId = this.find('#spec-comp-check-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'added') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'completeChecklist',
|
||||
boardId,
|
||||
'checklistName': checklistId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'removed') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'uncompleteChecklist',
|
||||
boardId,
|
||||
'checklistName': checklistId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-gen-check-item-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#check-item-gen-action').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'checked') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'checkedItem',
|
||||
boardId,
|
||||
'checklistItemName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'unchecked') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'uncheckedItem',
|
||||
boardId,
|
||||
'checklistItemName': '*',
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
'click .js-add-spec-check-item-trigger' (event) {
|
||||
const desc = Utils.getTriggerActionDesc(event, this);
|
||||
const datas = this.data();
|
||||
const actionSelected = this.find('#check-item-spec-action').value;
|
||||
const checklistItemId = this.find('#check-item-name').value;
|
||||
const boardId = Session.get('currentBoard');
|
||||
if (actionSelected === 'checked') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'checkedItem',
|
||||
boardId,
|
||||
'checklistItemName': checklistItemId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
if (actionSelected === 'unchecked') {
|
||||
datas.triggerVar.set({
|
||||
activityType: 'uncheckedItem',
|
||||
boardId,
|
||||
'checklistItemName': checklistItemId,
|
||||
desc,
|
||||
});
|
||||
}
|
||||
},
|
||||
}];
|
||||
},
|
||||
|
||||
}).register('checklistTriggers');
|
|
@ -4,7 +4,6 @@ window.Modal = new class {
|
|||
constructor() {
|
||||
this._currentModal = new ReactiveVar(closedValue);
|
||||
this._onCloseGoTo = '';
|
||||
this._isWideModal = false;
|
||||
}
|
||||
|
||||
getHeaderName() {
|
||||
|
@ -21,10 +20,6 @@ window.Modal = new class {
|
|||
return this.getTemplateName() !== closedValue;
|
||||
}
|
||||
|
||||
isWide(){
|
||||
return this._isWideModal;
|
||||
}
|
||||
|
||||
close() {
|
||||
this._currentModal.set(closedValue);
|
||||
if (this._onCloseGoTo) {
|
||||
|
@ -32,16 +27,9 @@ window.Modal = new class {
|
|||
}
|
||||
}
|
||||
|
||||
openWide(modalName, { header = '', onCloseGoTo = ''} = {}) {
|
||||
this._currentModal.set({ header, modalName });
|
||||
this._onCloseGoTo = onCloseGoTo;
|
||||
this._isWideModal = true;
|
||||
}
|
||||
|
||||
open(modalName, { header = '', onCloseGoTo = ''} = {}) {
|
||||
this._currentModal.set({ header, modalName });
|
||||
this._onCloseGoTo = onCloseGoTo;
|
||||
|
||||
}
|
||||
}();
|
||||
|
||||
|
@ -50,5 +38,5 @@ Blaze.registerHelper('Modal', Modal);
|
|||
EscapeActions.register('modalWindow',
|
||||
() => Modal.close(),
|
||||
() => Modal.isOpen(),
|
||||
{ noClickEscapeOn: '.modal-container' }
|
||||
{ noClickEscapeOn: '.modal-content' }
|
||||
);
|
||||
|
|
|
@ -39,11 +39,11 @@ Utils = {
|
|||
if (!prevData && !nextData) {
|
||||
base = 0;
|
||||
increment = 1;
|
||||
// If we drop the card in the first position
|
||||
// If we drop the card in the first position
|
||||
} else if (!prevData) {
|
||||
base = nextData.sort - 1;
|
||||
increment = -1;
|
||||
// If we drop the card in the last position
|
||||
// If we drop the card in the last position
|
||||
} else if (!nextData) {
|
||||
base = prevData.sort + 1;
|
||||
increment = 1;
|
||||
|
@ -71,11 +71,11 @@ Utils = {
|
|||
if (!prevCardDomElement && !nextCardDomElement) {
|
||||
base = 0;
|
||||
increment = 1;
|
||||
// If we drop the card in the first position
|
||||
// If we drop the card in the first position
|
||||
} else if (!prevCardDomElement) {
|
||||
base = Blaze.getData(nextCardDomElement).sort - 1;
|
||||
increment = -1;
|
||||
// If we drop the card in the last position
|
||||
// If we drop the card in the last position
|
||||
} else if (!nextCardDomElement) {
|
||||
base = Blaze.getData(prevCardDomElement).sort + 1;
|
||||
increment = 1;
|
||||
|
@ -189,27 +189,6 @@ Utils = {
|
|||
window._paq.push(['trackPageView']);
|
||||
}
|
||||
},
|
||||
|
||||
getTriggerActionDesc(event, tempInstance) {
|
||||
const jqueryEl = tempInstance.$(event.currentTarget.parentNode);
|
||||
const triggerEls = jqueryEl.find('.trigger-content').children();
|
||||
let finalString = '';
|
||||
for (let i = 0; i < triggerEls.length; i++) {
|
||||
const element = tempInstance.$(triggerEls[i]);
|
||||
if (element.hasClass('trigger-text')) {
|
||||
finalString += element.text().toLowerCase();
|
||||
} else if (element.find('select').length > 0) {
|
||||
finalString += element.find('select option:selected').text().toLowerCase();
|
||||
} else if (element.find('input').length > 0) {
|
||||
finalString += element.find('input').val();
|
||||
}
|
||||
// Add space
|
||||
if (i !== length - 1) {
|
||||
finalString += ' ';
|
||||
}
|
||||
}
|
||||
return finalString;
|
||||
},
|
||||
};
|
||||
|
||||
// A simple tracker dependency that we invalidate every time the window is
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
Actions = new Mongo.Collection('actions');
|
||||
|
||||
Actions.allow({
|
||||
insert(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
update(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
});
|
||||
|
||||
Actions.helpers({
|
||||
description() {
|
||||
return this.desc;
|
||||
},
|
||||
});
|
|
@ -56,14 +56,6 @@ Activities.before.insert((userId, doc) => {
|
|||
doc.createdAt = new Date();
|
||||
});
|
||||
|
||||
|
||||
Activities.after.insert((userId, doc) => {
|
||||
const activity = Activities._transform(doc);
|
||||
RulesHelper.executeRules(activity);
|
||||
|
||||
});
|
||||
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// For efficiency create indexes on the date of creation, and on the date of
|
||||
// creation in conjunction with the card or board id, as corresponding views
|
||||
|
|
|
@ -86,12 +86,5 @@ if (Meteor.isServer) {
|
|||
Activities.remove({
|
||||
attachmentId: doc._id,
|
||||
});
|
||||
Activities.insert({
|
||||
userId,
|
||||
type: 'card',
|
||||
activityType: 'deleteAttachment',
|
||||
boardId: doc.boardId,
|
||||
cardId: doc.cardId,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -280,10 +280,6 @@ Boards.helpers({
|
|||
return _.findWhere(this.labels, { name, color });
|
||||
},
|
||||
|
||||
getLabelById(labelId){
|
||||
return _.findWhere(this.labels, { _id: labelId });
|
||||
},
|
||||
|
||||
labelIndex(labelId) {
|
||||
return _.pluck(this.labels, '_id').indexOf(labelId);
|
||||
},
|
||||
|
|
404
models/cards.js
404
models/cards.js
|
@ -276,22 +276,14 @@ Cards.helpers({
|
|||
return Cards.find({
|
||||
parentId: this._id,
|
||||
archived: false,
|
||||
}, {
|
||||
sort: {
|
||||
sort: 1,
|
||||
},
|
||||
});
|
||||
}, {sort: { sort: 1 } });
|
||||
},
|
||||
|
||||
allSubtasks() {
|
||||
return Cards.find({
|
||||
parentId: this._id,
|
||||
archived: false,
|
||||
}, {
|
||||
sort: {
|
||||
sort: 1,
|
||||
},
|
||||
});
|
||||
}, {sort: { sort: 1 } });
|
||||
},
|
||||
|
||||
subtasksCount() {
|
||||
|
@ -304,8 +296,7 @@ Cards.helpers({
|
|||
subtasksFinishedCount() {
|
||||
return Cards.find({
|
||||
parentId: this._id,
|
||||
archived: true,
|
||||
}).count();
|
||||
archived: true}).count();
|
||||
},
|
||||
|
||||
subtasksFinished() {
|
||||
|
@ -337,9 +328,12 @@ Cards.helpers({
|
|||
});
|
||||
//search for "True Value" which is for DropDowns other then the Value (which is the id)
|
||||
let trueValue = customField.value;
|
||||
if (definition.settings.dropdownItems && definition.settings.dropdownItems.length > 0) {
|
||||
for (let i = 0; i < definition.settings.dropdownItems.length; i++) {
|
||||
if (definition.settings.dropdownItems[i]._id === customField.value) {
|
||||
if (definition.settings.dropdownItems && definition.settings.dropdownItems.length > 0)
|
||||
{
|
||||
for (let i = 0; i < definition.settings.dropdownItems.length; i++)
|
||||
{
|
||||
if (definition.settings.dropdownItems[i]._id === customField.value)
|
||||
{
|
||||
trueValue = definition.settings.dropdownItems[i].name;
|
||||
}
|
||||
}
|
||||
|
@ -364,10 +358,8 @@ Cards.helpers({
|
|||
},
|
||||
|
||||
canBeRestored() {
|
||||
const list = Lists.findOne({
|
||||
_id: this.listId,
|
||||
});
|
||||
if (!list.getWipLimit('soft') && list.getWipLimit('enabled') && list.getWipLimit('value') === list.cards().count()) {
|
||||
const list = Lists.findOne({_id: this.listId});
|
||||
if(!list.getWipLimit('soft') && list.getWipLimit('enabled') && list.getWipLimit('value') === list.cards().count()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -432,7 +424,7 @@ Cards.helpers({
|
|||
},
|
||||
|
||||
parentString(sep) {
|
||||
return this.parentList().map(function(elem) {
|
||||
return this.parentList().map(function(elem){
|
||||
return elem.title;
|
||||
}).join(sep);
|
||||
},
|
||||
|
@ -834,65 +826,19 @@ Cards.helpers({
|
|||
|
||||
Cards.mutations({
|
||||
applyToChildren(funct) {
|
||||
Cards.find({
|
||||
parentId: this._id,
|
||||
}).forEach((card) => {
|
||||
Cards.find({ parentId: this._id }).forEach((card) => {
|
||||
funct(card);
|
||||
});
|
||||
},
|
||||
|
||||
archive() {
|
||||
this.applyToChildren((card) => {
|
||||
return card.archive();
|
||||
});
|
||||
return {
|
||||
$set: {
|
||||
archived: true,
|
||||
},
|
||||
};
|
||||
this.applyToChildren((card) => { return card.archive(); });
|
||||
return {$set: {archived: true}};
|
||||
},
|
||||
|
||||
restore() {
|
||||
this.applyToChildren((card) => {
|
||||
return card.restore();
|
||||
});
|
||||
return {
|
||||
$set: {
|
||||
archived: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setTitle(title) {
|
||||
return {
|
||||
$set: {
|
||||
title,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setDescription(description) {
|
||||
return {
|
||||
$set: {
|
||||
description,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setRequestedBy(requestedBy) {
|
||||
return {
|
||||
$set: {
|
||||
requestedBy,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setAssignedBy(assignedBy) {
|
||||
return {
|
||||
$set: {
|
||||
assignedBy,
|
||||
},
|
||||
};
|
||||
this.applyToChildren((card) => { return card.restore(); });
|
||||
return {$set: {archived: false}};
|
||||
},
|
||||
|
||||
move(swimlaneId, listId, sortIndex) {
|
||||
|
@ -904,25 +850,15 @@ Cards.mutations({
|
|||
sort: sortIndex,
|
||||
};
|
||||
|
||||
return {
|
||||
$set: mutatedFields,
|
||||
};
|
||||
return {$set: mutatedFields};
|
||||
},
|
||||
|
||||
addLabel(labelId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
labelIds: labelId,
|
||||
},
|
||||
};
|
||||
return {$addToSet: {labelIds: labelId}};
|
||||
},
|
||||
|
||||
removeLabel(labelId) {
|
||||
return {
|
||||
$pull: {
|
||||
labelIds: labelId,
|
||||
},
|
||||
};
|
||||
return {$pull: {labelIds: labelId}};
|
||||
},
|
||||
|
||||
toggleLabel(labelId) {
|
||||
|
@ -933,49 +869,12 @@ Cards.mutations({
|
|||
}
|
||||
},
|
||||
|
||||
assignMember(memberId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
members: memberId,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unassignMember(memberId) {
|
||||
return {
|
||||
$pull: {
|
||||
members: memberId,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
toggleMember(memberId) {
|
||||
if (this.members && this.members.indexOf(memberId) > -1) {
|
||||
return this.unassignMember(memberId);
|
||||
} else {
|
||||
return this.assignMember(memberId);
|
||||
}
|
||||
},
|
||||
|
||||
assignCustomField(customFieldId) {
|
||||
return {
|
||||
$addToSet: {
|
||||
customFields: {
|
||||
_id: customFieldId,
|
||||
value: null,
|
||||
},
|
||||
},
|
||||
};
|
||||
return {$addToSet: {customFields: {_id: customFieldId, value: null}}};
|
||||
},
|
||||
|
||||
unassignCustomField(customFieldId) {
|
||||
return {
|
||||
$pull: {
|
||||
customFields: {
|
||||
_id: customFieldId,
|
||||
},
|
||||
},
|
||||
};
|
||||
return {$pull: {customFields: {_id: customFieldId}}};
|
||||
},
|
||||
|
||||
toggleCustomField(customFieldId) {
|
||||
|
@ -990,9 +889,7 @@ Cards.mutations({
|
|||
// todo
|
||||
const index = this.customFieldIndex(customFieldId);
|
||||
if (index > -1) {
|
||||
const update = {
|
||||
$set: {},
|
||||
};
|
||||
const update = {$set: {}};
|
||||
update.$set[`customFields.${index}.value`] = value;
|
||||
return update;
|
||||
}
|
||||
|
@ -1002,119 +899,19 @@ Cards.mutations({
|
|||
},
|
||||
|
||||
setCover(coverId) {
|
||||
return {
|
||||
$set: {
|
||||
coverId,
|
||||
},
|
||||
};
|
||||
return {$set: {coverId}};
|
||||
},
|
||||
|
||||
unsetCover() {
|
||||
return {
|
||||
$unset: {
|
||||
coverId: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setReceived(receivedAt) {
|
||||
return {
|
||||
$set: {
|
||||
receivedAt,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unsetReceived() {
|
||||
return {
|
||||
$unset: {
|
||||
receivedAt: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setStart(startAt) {
|
||||
return {
|
||||
$set: {
|
||||
startAt,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unsetStart() {
|
||||
return {
|
||||
$unset: {
|
||||
startAt: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setDue(dueAt) {
|
||||
return {
|
||||
$set: {
|
||||
dueAt,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unsetDue() {
|
||||
return {
|
||||
$unset: {
|
||||
dueAt: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setEnd(endAt) {
|
||||
return {
|
||||
$set: {
|
||||
endAt,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unsetEnd() {
|
||||
return {
|
||||
$unset: {
|
||||
endAt: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setOvertime(isOvertime) {
|
||||
return {
|
||||
$set: {
|
||||
isOvertime,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
setSpentTime(spentTime) {
|
||||
return {
|
||||
$set: {
|
||||
spentTime,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
unsetSpentTime() {
|
||||
return {
|
||||
$unset: {
|
||||
spentTime: '',
|
||||
isOvertime: false,
|
||||
},
|
||||
};
|
||||
return {$unset: {coverId: ''}};
|
||||
},
|
||||
|
||||
setParentId(parentId) {
|
||||
return {
|
||||
$set: {
|
||||
parentId,
|
||||
},
|
||||
};
|
||||
return {$set: {parentId}};
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//FUNCTIONS FOR creation of Activities
|
||||
|
||||
function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
|
||||
|
@ -1124,7 +921,6 @@ function cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId) {
|
|||
userId,
|
||||
oldListId,
|
||||
activityType: 'moveCard',
|
||||
listName: Lists.findOne(doc.listId).title,
|
||||
listId: doc.listId,
|
||||
boardId: doc.boardId,
|
||||
cardId: doc._id,
|
||||
|
@ -1140,7 +936,6 @@ function cardState(userId, doc, fieldNames) {
|
|||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'archivedCard',
|
||||
listName: Lists.findOne(doc.listId).title,
|
||||
boardId: doc.boardId,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
|
@ -1150,7 +945,6 @@ function cardState(userId, doc, fieldNames) {
|
|||
userId,
|
||||
activityType: 'restoredCard',
|
||||
boardId: doc.boardId,
|
||||
listName: Lists.findOne(doc.listId).title,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
});
|
||||
|
@ -1192,47 +986,11 @@ function cardMembers(userId, doc, fieldNames, modifier) {
|
|||
}
|
||||
}
|
||||
|
||||
function cardLabels(userId, doc, fieldNames, modifier) {
|
||||
if (!_.contains(fieldNames, 'labelIds'))
|
||||
return;
|
||||
let labelId;
|
||||
// Say hello to the new label
|
||||
if (modifier.$addToSet && modifier.$addToSet.labelIds) {
|
||||
labelId = modifier.$addToSet.labelIds;
|
||||
if (!_.contains(doc.labelIds, labelId)) {
|
||||
const act = {
|
||||
userId,
|
||||
labelId,
|
||||
activityType: 'addedLabel',
|
||||
boardId: doc.boardId,
|
||||
cardId: doc._id,
|
||||
};
|
||||
Activities.insert(act);
|
||||
}
|
||||
}
|
||||
|
||||
// Say goodbye to the label
|
||||
if (modifier.$pull && modifier.$pull.labelIds) {
|
||||
labelId = modifier.$pull.labelIds;
|
||||
// Check that the former member is member of the card
|
||||
if (_.contains(doc.labelIds, labelId)) {
|
||||
Activities.insert({
|
||||
userId,
|
||||
labelId,
|
||||
activityType: 'removedLabel',
|
||||
boardId: doc.boardId,
|
||||
cardId: doc._id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cardCreation(userId, doc) {
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'createCard',
|
||||
boardId: doc.boardId,
|
||||
listName: Lists.findOne(doc.listId).title,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
swimlaneId: doc.swimlaneId,
|
||||
|
@ -1257,6 +1015,7 @@ function cardRemover(userId, doc) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Cards are often fetched within a board, so we create an index to make these
|
||||
// queries more efficient.
|
||||
|
@ -1280,7 +1039,7 @@ if (Meteor.isServer) {
|
|||
});
|
||||
|
||||
//New activity for card moves
|
||||
Cards.after.update(function(userId, doc, fieldNames) {
|
||||
Cards.after.update(function (userId, doc, fieldNames) {
|
||||
const oldListId = this.previous.listId;
|
||||
const oldSwimlaneId = this.previous.swimlaneId;
|
||||
cardMove(userId, doc, fieldNames, oldListId, oldSwimlaneId);
|
||||
|
@ -1291,11 +1050,6 @@ if (Meteor.isServer) {
|
|||
cardMembers(userId, doc, fieldNames, modifier);
|
||||
});
|
||||
|
||||
// Add a new activity if we add or remove a label to the card
|
||||
Cards.before.update((userId, doc, fieldNames, modifier) => {
|
||||
cardLabels(userId, doc, fieldNames, modifier);
|
||||
});
|
||||
|
||||
// Remove all activities associated with a card if we remove the card
|
||||
// Remove also card_comments / checklists / attachments
|
||||
Cards.after.remove((userId, doc) => {
|
||||
|
@ -1304,17 +1058,13 @@ if (Meteor.isServer) {
|
|||
}
|
||||
//LISTS REST API
|
||||
if (Meteor.isServer) {
|
||||
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function(req, res) {
|
||||
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards', function (req, res) {
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramListId = req.params.listId;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: Cards.find({
|
||||
boardId: paramBoardId,
|
||||
listId: paramListId,
|
||||
archived: false,
|
||||
}).map(function(doc) {
|
||||
data: Cards.find({boardId: paramBoardId, listId: paramListId, archived: false}).map(function (doc) {
|
||||
return {
|
||||
_id: doc._id,
|
||||
title: doc.title,
|
||||
|
@ -1324,31 +1074,24 @@ if (Meteor.isServer) {
|
|||
});
|
||||
});
|
||||
|
||||
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards/:cardId', function(req, res) {
|
||||
JsonRoutes.add('GET', '/api/boards/:boardId/lists/:listId/cards/:cardId', function (req, res) {
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramListId = req.params.listId;
|
||||
const paramCardId = req.params.cardId;
|
||||
Authentication.checkBoardAccess(req.userId, paramBoardId);
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: Cards.findOne({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
}),
|
||||
data: Cards.findOne({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false}),
|
||||
});
|
||||
});
|
||||
|
||||
JsonRoutes.add('POST', '/api/boards/:boardId/lists/:listId/cards', function(req, res) {
|
||||
JsonRoutes.add('POST', '/api/boards/:boardId/lists/:listId/cards', function (req, res) {
|
||||
Authentication.checkUserId(req.userId);
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramListId = req.params.listId;
|
||||
const check = Users.findOne({
|
||||
_id: req.body.authorId,
|
||||
});
|
||||
const check = Users.findOne({_id: req.body.authorId});
|
||||
const members = req.body.members || [req.body.authorId];
|
||||
if (typeof check !== 'undefined') {
|
||||
if (typeof check !== 'undefined') {
|
||||
const id = Cards.direct.insert({
|
||||
title: req.body.title,
|
||||
boardId: paramBoardId,
|
||||
|
@ -1366,9 +1109,7 @@ if (Meteor.isServer) {
|
|||
},
|
||||
});
|
||||
|
||||
const card = Cards.findOne({
|
||||
_id: id,
|
||||
});
|
||||
const card = Cards.findOne({_id:id});
|
||||
cardCreation(req.body.authorId, card);
|
||||
|
||||
} else {
|
||||
|
@ -1378,7 +1119,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
});
|
||||
|
||||
JsonRoutes.add('PUT', '/api/boards/:boardId/lists/:listId/cards/:cardId', function(req, res) {
|
||||
JsonRoutes.add('PUT', '/api/boards/:boardId/lists/:listId/cards/:cardId', function (req, res) {
|
||||
Authentication.checkUserId(req.userId);
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramCardId = req.params.cardId;
|
||||
|
@ -1386,63 +1127,27 @@ if (Meteor.isServer) {
|
|||
|
||||
if (req.body.hasOwnProperty('title')) {
|
||||
const newTitle = req.body.title;
|
||||
Cards.direct.update({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
}, {
|
||||
$set: {
|
||||
title: newTitle,
|
||||
},
|
||||
});
|
||||
Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false},
|
||||
{$set: {title: newTitle}});
|
||||
}
|
||||
if (req.body.hasOwnProperty('listId')) {
|
||||
const newParamListId = req.body.listId;
|
||||
Cards.direct.update({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
}, {
|
||||
$set: {
|
||||
listId: newParamListId,
|
||||
},
|
||||
});
|
||||
Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false},
|
||||
{$set: {listId: newParamListId}});
|
||||
|
||||
const card = Cards.findOne({
|
||||
_id: paramCardId,
|
||||
});
|
||||
cardMove(req.body.authorId, card, {
|
||||
fieldName: 'listId',
|
||||
}, paramListId);
|
||||
const card = Cards.findOne({_id: paramCardId} );
|
||||
cardMove(req.body.authorId, card, {fieldName: 'listId'}, paramListId);
|
||||
|
||||
}
|
||||
if (req.body.hasOwnProperty('description')) {
|
||||
const newDescription = req.body.description;
|
||||
Cards.direct.update({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
}, {
|
||||
$set: {
|
||||
description: newDescription,
|
||||
},
|
||||
});
|
||||
Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false},
|
||||
{$set: {description: newDescription}});
|
||||
}
|
||||
if (req.body.hasOwnProperty('labelIds')) {
|
||||
const newlabelIds = req.body.labelIds;
|
||||
Cards.direct.update({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
archived: false,
|
||||
}, {
|
||||
$set: {
|
||||
labelIds: newlabelIds,
|
||||
},
|
||||
});
|
||||
Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false},
|
||||
{$set: {labelIds: newlabelIds}});
|
||||
}
|
||||
if (req.body.hasOwnProperty('requestedBy')) {
|
||||
const newrequestedBy = req.body.requestedBy;
|
||||
|
@ -1497,20 +1202,15 @@ if (Meteor.isServer) {
|
|||
});
|
||||
});
|
||||
|
||||
JsonRoutes.add('DELETE', '/api/boards/:boardId/lists/:listId/cards/:cardId', function(req, res) {
|
||||
|
||||
JsonRoutes.add('DELETE', '/api/boards/:boardId/lists/:listId/cards/:cardId', function (req, res) {
|
||||
Authentication.checkUserId(req.userId);
|
||||
const paramBoardId = req.params.boardId;
|
||||
const paramListId = req.params.listId;
|
||||
const paramCardId = req.params.cardId;
|
||||
|
||||
Cards.direct.remove({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
});
|
||||
const card = Cards.find({
|
||||
_id: paramCardId,
|
||||
});
|
||||
Cards.direct.remove({_id: paramCardId, listId: paramListId, boardId: paramBoardId});
|
||||
const card = Cards.find({_id: paramCardId} );
|
||||
cardRemover(req.body.authorId, card);
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
|
|
|
@ -44,12 +44,6 @@ ChecklistItems.mutations({
|
|||
setTitle(title) {
|
||||
return { $set: { title } };
|
||||
},
|
||||
check(){
|
||||
return { $set: { isFinished: true } };
|
||||
},
|
||||
uncheck(){
|
||||
return { $set: { isFinished: false } };
|
||||
},
|
||||
toggleItem() {
|
||||
return { $set: { isFinished: !this.isFinished } };
|
||||
},
|
||||
|
@ -76,100 +70,21 @@ function itemCreation(userId, doc) {
|
|||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title,
|
||||
});
|
||||
}
|
||||
|
||||
function itemRemover(userId, doc) {
|
||||
const card = Cards.findOne(doc.cardId);
|
||||
const boardId = card.boardId;
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'removedChecklistItem',
|
||||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title,
|
||||
});
|
||||
Activities.remove({
|
||||
checklistItemId: doc._id,
|
||||
});
|
||||
}
|
||||
|
||||
function publishCheckActivity(userId, doc){
|
||||
const card = Cards.findOne(doc.cardId);
|
||||
const boardId = card.boardId;
|
||||
let activityType;
|
||||
if(doc.isFinished){
|
||||
activityType = 'checkedItem';
|
||||
}else{
|
||||
activityType = 'uncheckedItem';
|
||||
}
|
||||
const act = {
|
||||
userId,
|
||||
activityType,
|
||||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title,
|
||||
};
|
||||
Activities.insert(act);
|
||||
}
|
||||
|
||||
function publishChekListCompleted(userId, doc, fieldNames, modifier){
|
||||
const card = Cards.findOne(doc.cardId);
|
||||
const boardId = card.boardId;
|
||||
const checklistId = doc.checklistId;
|
||||
const checkList = Checklists.findOne({_id:checklistId});
|
||||
if(checkList.isFinished()){
|
||||
const act = {
|
||||
userId,
|
||||
activityType: 'checklistCompleted',
|
||||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistName:doc.title,
|
||||
};
|
||||
Activities.insert(act);
|
||||
}
|
||||
}
|
||||
|
||||
function publishChekListUncompleted(userId, doc, fieldNames, modifier){
|
||||
const card = Cards.findOne(doc.cardId);
|
||||
const boardId = card.boardId;
|
||||
const checklistId = doc.checklistId;
|
||||
const checkList = Checklists.findOne({_id:checklistId});
|
||||
if(checkList.isFinished()){
|
||||
const act = {
|
||||
userId,
|
||||
activityType: 'checklistUncompleted',
|
||||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistName:doc.title,
|
||||
};
|
||||
Activities.insert(act);
|
||||
}
|
||||
}
|
||||
|
||||
// Activities
|
||||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
ChecklistItems._collection._ensureIndex({ checklistId: 1 });
|
||||
});
|
||||
|
||||
ChecklistItems.after.update((userId, doc, fieldNames, modifier) => {
|
||||
publishCheckActivity(userId, doc);
|
||||
publishChekListCompleted(userId, doc, fieldNames, modifier);
|
||||
});
|
||||
|
||||
ChecklistItems.before.update((userId, doc, fieldNames, modifier) => {
|
||||
publishChekListUncompleted(userId, doc, fieldNames, modifier);
|
||||
});
|
||||
|
||||
|
||||
ChecklistItems.after.insert((userId, doc) => {
|
||||
itemCreation(userId, doc);
|
||||
});
|
||||
|
|
|
@ -47,18 +47,6 @@ Checklists.helpers({
|
|||
isFinished() {
|
||||
return 0 !== this.itemCount() && this.itemCount() === this.finishedCount();
|
||||
},
|
||||
checkAllItems(){
|
||||
const checkItems = ChecklistItems.find({checklistId: this._id});
|
||||
checkItems.forEach(function(item){
|
||||
item.check();
|
||||
});
|
||||
},
|
||||
uncheckAllItems(){
|
||||
const checkItems = ChecklistItems.find({checklistId: this._id});
|
||||
checkItems.forEach(function(item){
|
||||
item.uncheck();
|
||||
});
|
||||
},
|
||||
itemIndex(itemId) {
|
||||
const items = self.findOne({_id : this._id}).items;
|
||||
return _.pluck(items, '_id').indexOf(itemId);
|
||||
|
@ -103,7 +91,6 @@ if (Meteor.isServer) {
|
|||
cardId: doc.cardId,
|
||||
boardId: Cards.findOne(doc.cardId).boardId,
|
||||
checklistId: doc._id,
|
||||
checklistName:doc.title,
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -114,16 +101,6 @@ if (Meteor.isServer) {
|
|||
Activities.remove(activity._id);
|
||||
});
|
||||
}
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'removeChecklist',
|
||||
cardId: doc.cardId,
|
||||
boardId: Cards.findOne(doc.cardId).boardId,
|
||||
checklistId: doc._id,
|
||||
checklistName:doc.title,
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ if (Meteor.isServer) {
|
|||
* See https://blog.kayla.com.au/server-side-route-authentication-in-meteor/
|
||||
* for detailed explanations
|
||||
*/
|
||||
JsonRoutes.add('get', '/api/boards/:boardId/export', function(req, res) {
|
||||
JsonRoutes.add('get', '/api/boards/:boardId/export', function (req, res) {
|
||||
const boardId = req.params.boardId;
|
||||
let user = null;
|
||||
// todo XXX for real API, first look for token in Authentication: header
|
||||
|
@ -28,11 +28,8 @@ if (Meteor.isServer) {
|
|||
}
|
||||
|
||||
const exporter = new Exporter(boardId);
|
||||
if (exporter.canExport(user)) {
|
||||
JsonRoutes.sendResult(res, {
|
||||
code: 200,
|
||||
data: exporter.build(),
|
||||
});
|
||||
if(exporter.canExport(user)) {
|
||||
JsonRoutes.sendResult(res, { code: 200, data: exporter.build() });
|
||||
} else {
|
||||
// we could send an explicit error message, but on the other hand the only
|
||||
// way to get there is by hacking the UI so let's keep it raw.
|
||||
|
@ -50,49 +47,24 @@ class Exporter {
|
|||
const byBoard = { boardId: this._boardId };
|
||||
const byBoardNoLinked = { boardId: this._boardId, linkedId: '' };
|
||||
// we do not want to retrieve boardId in related elements
|
||||
const noBoardId = {
|
||||
fields: {
|
||||
boardId: 0,
|
||||
},
|
||||
};
|
||||
const noBoardId = { fields: { boardId: 0 } };
|
||||
const result = {
|
||||
_format: 'wekan-board-1.0.0',
|
||||
};
|
||||
_.extend(result, Boards.findOne(this._boardId, {
|
||||
fields: {
|
||||
stars: 0,
|
||||
},
|
||||
}));
|
||||
_.extend(result, Boards.findOne(this._boardId, { fields: { stars: 0 } }));
|
||||
result.lists = Lists.find(byBoard, noBoardId).fetch();
|
||||
result.cards = Cards.find(byBoardNoLinked, noBoardId).fetch();
|
||||
result.swimlanes = Swimlanes.find(byBoard, noBoardId).fetch();
|
||||
result.customFields = CustomFields.find(byBoard, noBoardId).fetch();
|
||||
result.comments = CardComments.find(byBoard, noBoardId).fetch();
|
||||
result.activities = Activities.find(byBoard, noBoardId).fetch();
|
||||
result.rules = Rules.find(byBoard, noBoardId).fetch();
|
||||
result.checklists = [];
|
||||
result.checklistItems = [];
|
||||
result.subtaskItems = [];
|
||||
result.triggers = [];
|
||||
result.actions = [];
|
||||
result.cards.forEach((card) => {
|
||||
result.checklists.push(...Checklists.find({
|
||||
cardId: card._id,
|
||||
}).fetch());
|
||||
result.checklistItems.push(...ChecklistItems.find({
|
||||
cardId: card._id,
|
||||
}).fetch());
|
||||
result.subtaskItems.push(...Cards.find({
|
||||
parentid: card._id,
|
||||
}).fetch());
|
||||
});
|
||||
result.rules.forEach((rule) => {
|
||||
result.triggers.push(...Triggers.find({
|
||||
_id: rule.triggerId,
|
||||
}, noBoardId).fetch());
|
||||
result.actions.push(...Actions.find({
|
||||
_id: rule.actionId,
|
||||
}, noBoardId).fetch());
|
||||
result.checklists.push(...Checklists.find({ cardId: card._id }).fetch());
|
||||
result.checklistItems.push(...ChecklistItems.find({ cardId: card._id }).fetch());
|
||||
result.subtaskItems.push(...Cards.find({ parentid: card._id }).fetch());
|
||||
});
|
||||
|
||||
// [Old] for attachments we only export IDs and absolute url to original doc
|
||||
|
@ -129,34 +101,18 @@ class Exporter {
|
|||
// 1- only exports users that are linked somehow to that board
|
||||
// 2- do not export any sensitive information
|
||||
const users = {};
|
||||
result.members.forEach((member) => {
|
||||
users[member.userId] = true;
|
||||
});
|
||||
result.lists.forEach((list) => {
|
||||
users[list.userId] = true;
|
||||
});
|
||||
result.members.forEach((member) => { users[member.userId] = true; });
|
||||
result.lists.forEach((list) => { users[list.userId] = true; });
|
||||
result.cards.forEach((card) => {
|
||||
users[card.userId] = true;
|
||||
if (card.members) {
|
||||
card.members.forEach((memberId) => {
|
||||
users[memberId] = true;
|
||||
});
|
||||
card.members.forEach((memberId) => { users[memberId] = true; });
|
||||
}
|
||||
});
|
||||
result.comments.forEach((comment) => {
|
||||
users[comment.userId] = true;
|
||||
});
|
||||
result.activities.forEach((activity) => {
|
||||
users[activity.userId] = true;
|
||||
});
|
||||
result.checklists.forEach((checklist) => {
|
||||
users[checklist.userId] = true;
|
||||
});
|
||||
const byUserIds = {
|
||||
_id: {
|
||||
$in: Object.getOwnPropertyNames(users),
|
||||
},
|
||||
};
|
||||
result.comments.forEach((comment) => { users[comment.userId] = true; });
|
||||
result.activities.forEach((activity) => { users[activity.userId] = true; });
|
||||
result.checklists.forEach((checklist) => { users[checklist.userId] = true; });
|
||||
const byUserIds = { _id: { $in: Object.getOwnPropertyNames(users) } };
|
||||
// we use whitelist to be sure we do not expose inadvertently
|
||||
// some secret fields that gets added to User later.
|
||||
const userFields = {
|
||||
|
|
|
@ -82,7 +82,7 @@ Lists.helpers({
|
|||
};
|
||||
if (swimlaneId)
|
||||
selector.swimlaneId = swimlaneId;
|
||||
return Cards.find(selector,
|
||||
return Cards.find(Filter.mongoSelector(selector),
|
||||
{ sort: ['sort'] });
|
||||
},
|
||||
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
Rules = new Mongo.Collection('rules');
|
||||
|
||||
Rules.attachSchema(new SimpleSchema({
|
||||
title: {
|
||||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
triggerId: {
|
||||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
actionId: {
|
||||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
boardId: {
|
||||
type: String,
|
||||
optional: false,
|
||||
},
|
||||
}));
|
||||
|
||||
Rules.mutations({
|
||||
rename(description) {
|
||||
return { $set: { description } };
|
||||
},
|
||||
});
|
||||
|
||||
Rules.helpers({
|
||||
getAction(){
|
||||
return Actions.findOne({_id:this.actionId});
|
||||
},
|
||||
getTrigger(){
|
||||
return Triggers.findOne({_id:this.triggerId});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Rules.allow({
|
||||
insert(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
update(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
});
|
|
@ -1,58 +0,0 @@
|
|||
Triggers = new Mongo.Collection('triggers');
|
||||
|
||||
Triggers.mutations({
|
||||
rename(description) {
|
||||
return {
|
||||
$set: {
|
||||
description,
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Triggers.allow({
|
||||
insert(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
update(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
remove(userId, doc) {
|
||||
return allowIsBoardAdmin(userId, Boards.findOne(doc.boardId));
|
||||
},
|
||||
});
|
||||
|
||||
Triggers.helpers({
|
||||
|
||||
description() {
|
||||
return this.desc;
|
||||
},
|
||||
|
||||
getRule() {
|
||||
return Rules.findOne({
|
||||
triggerId: this._id,
|
||||
});
|
||||
},
|
||||
|
||||
fromList() {
|
||||
return Lists.findOne(this.fromId);
|
||||
},
|
||||
|
||||
toList() {
|
||||
return Lists.findOne(this.toId);
|
||||
},
|
||||
|
||||
findList(title) {
|
||||
return Lists.findOne({
|
||||
title,
|
||||
});
|
||||
},
|
||||
|
||||
labels() {
|
||||
const boardLabels = this.board().labels;
|
||||
const cardLabels = _.filter(boardLabels, (label) => {
|
||||
return _.contains(this.labelIds, label._id);
|
||||
});
|
||||
return cardLabels;
|
||||
},
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
const DateString = Match.Where(function(dateAsString) {
|
||||
const DateString = Match.Where(function (dateAsString) {
|
||||
check(dateAsString, String);
|
||||
return moment(dateAsString, moment.ISO_8601).isValid();
|
||||
});
|
||||
|
@ -42,10 +42,6 @@ export class WekanCreator {
|
|||
this.comments = {};
|
||||
// the members, indexed by Wekan member id => Wekan user ID
|
||||
this.members = data.membersMapping ? data.membersMapping : {};
|
||||
// Map of triggers Wekan ID => Wekan ID
|
||||
this.triggers = {};
|
||||
// Map of actions Wekan ID => Wekan ID
|
||||
this.actions = {};
|
||||
|
||||
// maps a wekanCardId to an array of wekanAttachments
|
||||
this.attachments = {};
|
||||
|
@ -61,10 +57,10 @@ export class WekanCreator {
|
|||
* @param {String} dateString a properly formatted Date
|
||||
*/
|
||||
_now(dateString) {
|
||||
if (dateString) {
|
||||
if(dateString) {
|
||||
return new Date(dateString);
|
||||
}
|
||||
if (!this._nowDate) {
|
||||
if(!this._nowDate) {
|
||||
this._nowDate = new Date();
|
||||
}
|
||||
return this._nowDate;
|
||||
|
@ -76,9 +72,9 @@ export class WekanCreator {
|
|||
* Otherwise return current logged user.
|
||||
* @param wekanUserId
|
||||
* @private
|
||||
*/
|
||||
*/
|
||||
_user(wekanUserId) {
|
||||
if (wekanUserId && this.members[wekanUserId]) {
|
||||
if(wekanUserId && this.members[wekanUserId]) {
|
||||
return this.members[wekanUserId];
|
||||
}
|
||||
return Meteor.userId();
|
||||
|
@ -100,7 +96,7 @@ export class WekanCreator {
|
|||
// allowed values (is it worth the maintenance?)
|
||||
color: String,
|
||||
permission: Match.Where((value) => {
|
||||
return ['private', 'public'].indexOf(value) >= 0;
|
||||
return ['private', 'public'].indexOf(value)>= 0;
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
@ -151,30 +147,6 @@ export class WekanCreator {
|
|||
})]);
|
||||
}
|
||||
|
||||
checkRules(wekanRules) {
|
||||
check(wekanRules, [Match.ObjectIncluding({
|
||||
triggerId: String,
|
||||
actionId: String,
|
||||
title: String,
|
||||
})]);
|
||||
}
|
||||
|
||||
checkTriggers(wekanTriggers) {
|
||||
// XXX More check based on trigger type
|
||||
check(wekanTriggers, [Match.ObjectIncluding({
|
||||
activityType: String,
|
||||
desc: String,
|
||||
})]);
|
||||
}
|
||||
|
||||
checkActions(wekanActions) {
|
||||
// XXX More check based on action type
|
||||
check(wekanActions, [Match.ObjectIncluding({
|
||||
actionType: String,
|
||||
desc: String,
|
||||
})]);
|
||||
}
|
||||
|
||||
// You must call parseActions before calling this one.
|
||||
createBoardAndLabels(boardToImport) {
|
||||
const boardToCreate = {
|
||||
|
@ -200,12 +172,12 @@ export class WekanCreator {
|
|||
title: boardToImport.title,
|
||||
};
|
||||
// now add other members
|
||||
if (boardToImport.members) {
|
||||
if(boardToImport.members) {
|
||||
boardToImport.members.forEach((wekanMember) => {
|
||||
// do we already have it in our list?
|
||||
if (!boardToCreate.members.some((member) => member.wekanId === wekanMember.wekanId))
|
||||
if(!boardToCreate.members.some((member) => member.wekanId === wekanMember.wekanId))
|
||||
boardToCreate.members.push({
|
||||
...wekanMember,
|
||||
... wekanMember,
|
||||
userId: wekanMember.wekanId,
|
||||
});
|
||||
});
|
||||
|
@ -222,11 +194,7 @@ export class WekanCreator {
|
|||
boardToCreate.labels.push(labelToCreate);
|
||||
});
|
||||
const boardId = Boards.direct.insert(boardToCreate);
|
||||
Boards.direct.update(boardId, {
|
||||
$set: {
|
||||
modifiedAt: this._now(),
|
||||
},
|
||||
});
|
||||
Boards.direct.update(boardId, {$set: {modifiedAt: this._now()}});
|
||||
// log activity
|
||||
Activities.direct.insert({
|
||||
activityType: 'importBoard',
|
||||
|
@ -278,21 +246,21 @@ export class WekanCreator {
|
|||
});
|
||||
}
|
||||
// add members {
|
||||
if (card.members) {
|
||||
if(card.members) {
|
||||
const wekanMembers = [];
|
||||
// we can't just map, as some members may not have been mapped
|
||||
card.members.forEach((sourceMemberId) => {
|
||||
if (this.members[sourceMemberId]) {
|
||||
if(this.members[sourceMemberId]) {
|
||||
const wekanId = this.members[sourceMemberId];
|
||||
// we may map multiple Wekan members to the same wekan user
|
||||
// in which case we risk adding the same user multiple times
|
||||
if (!wekanMembers.find((wId) => wId === wekanId)) {
|
||||
if(!wekanMembers.find((wId) => wId === wekanId)){
|
||||
wekanMembers.push(wekanId);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (wekanMembers.length > 0) {
|
||||
if(wekanMembers.length>0) {
|
||||
cardToCreate.members = wekanMembers;
|
||||
}
|
||||
}
|
||||
|
@ -353,9 +321,9 @@ export class WekanCreator {
|
|||
// - the template then tries to display the url to the attachment which causes other errors
|
||||
// so we make it server only, and let UI catch up once it is done, forget about latency comp.
|
||||
const self = this;
|
||||
if (Meteor.isServer) {
|
||||
if(Meteor.isServer) {
|
||||
if (att.url) {
|
||||
file.attachData(att.url, function(error) {
|
||||
file.attachData(att.url, function (error) {
|
||||
file.boardId = boardId;
|
||||
file.cardId = cardId;
|
||||
file.userId = self._user(att.userId);
|
||||
|
@ -363,26 +331,20 @@ export class WekanCreator {
|
|||
// attachments' related activities automatically
|
||||
file.source = 'import';
|
||||
if (error) {
|
||||
throw (error);
|
||||
throw(error);
|
||||
} else {
|
||||
const wekanAtt = Attachments.insert(file, () => {
|
||||
// we do nothing
|
||||
});
|
||||
self.attachmentIds[att._id] = wekanAtt._id;
|
||||
//
|
||||
if (wekanCoverId === att._id) {
|
||||
Cards.direct.update(cardId, {
|
||||
$set: {
|
||||
coverId: wekanAtt._id,
|
||||
},
|
||||
});
|
||||
if(wekanCoverId === att._id) {
|
||||
Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (att.file) {
|
||||
file.attachData(new Buffer(att.file, 'base64'), {
|
||||
type: att.type,
|
||||
}, (error) => {
|
||||
file.attachData(new Buffer(att.file, 'base64'), {type: att.type}, (error) => {
|
||||
file.name(att.name);
|
||||
file.boardId = boardId;
|
||||
file.cardId = cardId;
|
||||
|
@ -391,19 +353,15 @@ export class WekanCreator {
|
|||
// attachments' related activities automatically
|
||||
file.source = 'import';
|
||||
if (error) {
|
||||
throw (error);
|
||||
throw(error);
|
||||
} else {
|
||||
const wekanAtt = Attachments.insert(file, () => {
|
||||
// we do nothing
|
||||
});
|
||||
this.attachmentIds[att._id] = wekanAtt._id;
|
||||
//
|
||||
if (wekanCoverId === att._id) {
|
||||
Cards.direct.update(cardId, {
|
||||
$set: {
|
||||
coverId: wekanAtt._id,
|
||||
},
|
||||
});
|
||||
if(wekanCoverId === att._id) {
|
||||
Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -446,11 +404,7 @@ export class WekanCreator {
|
|||
sort: list.sort ? list.sort : listIndex,
|
||||
};
|
||||
const listId = Lists.direct.insert(listToCreate);
|
||||
Lists.direct.update(listId, {
|
||||
$set: {
|
||||
'updatedAt': this._now(),
|
||||
},
|
||||
});
|
||||
Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
|
||||
this.lists[list._id] = listId;
|
||||
// // log activity
|
||||
// Activities.direct.insert({
|
||||
|
@ -483,11 +437,7 @@ export class WekanCreator {
|
|||
sort: swimlane.sort ? swimlane.sort : swimlaneIndex,
|
||||
};
|
||||
const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
|
||||
Swimlanes.direct.update(swimlaneId, {
|
||||
$set: {
|
||||
'updatedAt': this._now(),
|
||||
},
|
||||
});
|
||||
Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});
|
||||
this.swimlanes[swimlane._id] = swimlaneId;
|
||||
});
|
||||
}
|
||||
|
@ -509,47 +459,6 @@ export class WekanCreator {
|
|||
return result;
|
||||
}
|
||||
|
||||
createTriggers(wekanTriggers, boardId) {
|
||||
wekanTriggers.forEach((trigger, ruleIndex) => {
|
||||
if (trigger.hasOwnProperty('labelId')) {
|
||||
trigger.labelId = this.labels[trigger.labelId];
|
||||
}
|
||||
if (trigger.hasOwnProperty('memberId')) {
|
||||
trigger.memberId = this.members[trigger.memberId];
|
||||
}
|
||||
trigger.boardId = boardId;
|
||||
const oldId = trigger._id;
|
||||
delete trigger._id;
|
||||
this.triggers[oldId] = Triggers.direct.insert(trigger);
|
||||
});
|
||||
}
|
||||
|
||||
createActions(wekanActions, boardId) {
|
||||
wekanActions.forEach((action, ruleIndex) => {
|
||||
if (action.hasOwnProperty('labelId')) {
|
||||
action.labelId = this.labels[action.labelId];
|
||||
}
|
||||
if (action.hasOwnProperty('memberId')) {
|
||||
action.memberId = this.members[action.memberId];
|
||||
}
|
||||
action.boardId = boardId;
|
||||
const oldId = action._id;
|
||||
delete action._id;
|
||||
this.actions[oldId] = Actions.direct.insert(action);
|
||||
});
|
||||
}
|
||||
|
||||
createRules(wekanRules, boardId) {
|
||||
wekanRules.forEach((rule, ruleIndex) => {
|
||||
// Create the rule
|
||||
rule.boardId = boardId;
|
||||
rule.triggerId = this.triggers[rule.triggerId];
|
||||
rule.actionId = this.actions[rule.actionId];
|
||||
delete rule._id;
|
||||
Rules.direct.insert(rule);
|
||||
});
|
||||
}
|
||||
|
||||
createChecklistItems(wekanChecklistItems) {
|
||||
wekanChecklistItems.forEach((checklistitem, checklistitemIndex) => {
|
||||
// Create the checklistItem
|
||||
|
@ -568,8 +477,7 @@ export class WekanCreator {
|
|||
parseActivities(wekanBoard) {
|
||||
wekanBoard.activities.forEach((activity) => {
|
||||
switch (activity.activityType) {
|
||||
case 'addAttachment':
|
||||
{
|
||||
case 'addAttachment': {
|
||||
// We have to be cautious, because the attachment could have been removed later.
|
||||
// In that case Wekan still reports its addition, but removes its 'url' field.
|
||||
// So we test for that
|
||||
|
@ -577,12 +485,12 @@ export class WekanCreator {
|
|||
return attachment._id === activity.attachmentId;
|
||||
})[0];
|
||||
|
||||
if (typeof wekanAttachment !== 'undefined' && wekanAttachment) {
|
||||
if (wekanAttachment.url || wekanAttachment.file) {
|
||||
// we cannot actually create the Wekan attachment, because we don't yet
|
||||
// have the cards to attach it to, so we store it in the instance variable.
|
||||
if ( typeof wekanAttachment !== 'undefined' && wekanAttachment ) {
|
||||
if(wekanAttachment.url || wekanAttachment.file) {
|
||||
// we cannot actually create the Wekan attachment, because we don't yet
|
||||
// have the cards to attach it to, so we store it in the instance variable.
|
||||
const wekanCardId = activity.cardId;
|
||||
if (!this.attachments[wekanCardId]) {
|
||||
if(!this.attachments[wekanCardId]) {
|
||||
this.attachments[wekanCardId] = [];
|
||||
}
|
||||
this.attachments[wekanCardId].push(wekanAttachment);
|
||||
|
@ -590,8 +498,7 @@ export class WekanCreator {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 'addComment':
|
||||
{
|
||||
case 'addComment': {
|
||||
const wekanComment = wekanBoard.comments.filter((comment) => {
|
||||
return comment._id === activity.commentId;
|
||||
})[0];
|
||||
|
@ -602,31 +509,26 @@ export class WekanCreator {
|
|||
this.comments[id].push(wekanComment);
|
||||
break;
|
||||
}
|
||||
case 'createBoard':
|
||||
{
|
||||
case 'createBoard': {
|
||||
this.createdAt.board = activity.createdAt;
|
||||
break;
|
||||
}
|
||||
case 'createCard':
|
||||
{
|
||||
case 'createCard': {
|
||||
const cardId = activity.cardId;
|
||||
this.createdAt.cards[cardId] = activity.createdAt;
|
||||
this.createdBy.cards[cardId] = activity.userId;
|
||||
break;
|
||||
}
|
||||
case 'createList':
|
||||
{
|
||||
case 'createList': {
|
||||
const listId = activity.listId;
|
||||
this.createdAt.lists[listId] = activity.createdAt;
|
||||
break;
|
||||
}
|
||||
case 'createSwimlane':
|
||||
{
|
||||
case 'createSwimlane': {
|
||||
const swimlaneId = activity.swimlaneId;
|
||||
this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -635,8 +537,7 @@ export class WekanCreator {
|
|||
switch (activity.activityType) {
|
||||
// Board related activities
|
||||
// TODO: addBoardMember, removeBoardMember
|
||||
case 'createBoard':
|
||||
{
|
||||
case 'createBoard': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
type: 'board',
|
||||
|
@ -649,8 +550,7 @@ export class WekanCreator {
|
|||
}
|
||||
// List related activities
|
||||
// TODO: removeList, archivedList
|
||||
case 'createList':
|
||||
{
|
||||
case 'createList': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
type: 'list',
|
||||
|
@ -663,8 +563,7 @@ export class WekanCreator {
|
|||
}
|
||||
// Card related activities
|
||||
// TODO: archivedCard, restoredCard, joinMember, unjoinMember
|
||||
case 'createCard':
|
||||
{
|
||||
case 'createCard': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
activityType: activity.activityType,
|
||||
|
@ -675,8 +574,7 @@ export class WekanCreator {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'moveCard':
|
||||
{
|
||||
case 'moveCard': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
oldListId: this.lists[activity.oldListId],
|
||||
|
@ -689,8 +587,7 @@ export class WekanCreator {
|
|||
break;
|
||||
}
|
||||
// Comment related activities
|
||||
case 'addComment':
|
||||
{
|
||||
case 'addComment': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
activityType: activity.activityType,
|
||||
|
@ -702,8 +599,7 @@ export class WekanCreator {
|
|||
break;
|
||||
}
|
||||
// Attachment related activities
|
||||
case 'addAttachment':
|
||||
{
|
||||
case 'addAttachment': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
type: 'card',
|
||||
|
@ -716,8 +612,7 @@ export class WekanCreator {
|
|||
break;
|
||||
}
|
||||
// Checklist related activities
|
||||
case 'addChecklist':
|
||||
{
|
||||
case 'addChecklist': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
activityType: activity.activityType,
|
||||
|
@ -728,8 +623,7 @@ export class WekanCreator {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case 'addChecklistItem':
|
||||
{
|
||||
case 'addChecklistItem': {
|
||||
Activities.direct.insert({
|
||||
userId: this._user(activity.userId),
|
||||
activityType: activity.activityType,
|
||||
|
@ -742,8 +636,7 @@ export class WekanCreator {
|
|||
createdAt: this._now(activity.createdAt),
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -759,9 +652,6 @@ export class WekanCreator {
|
|||
this.checkSwimlanes(board.swimlanes);
|
||||
this.checkCards(board.cards);
|
||||
this.checkChecklists(board.checklists);
|
||||
this.checkRules(board.rules);
|
||||
this.checkActions(board.actions);
|
||||
this.checkTriggers(board.triggers);
|
||||
this.checkChecklistItems(board.checklistItems);
|
||||
} catch (e) {
|
||||
throw new Meteor.Error('error-json-schema');
|
||||
|
@ -784,9 +674,6 @@ export class WekanCreator {
|
|||
this.createChecklists(board.checklists);
|
||||
this.createChecklistItems(board.checklistItems);
|
||||
this.importActivities(board.activities, boardId);
|
||||
this.createTriggers(board.triggers, boardId);
|
||||
this.createActions(board.actions, boardId);
|
||||
this.createRules(board.rules, boardId);
|
||||
// XXX add members
|
||||
return boardId;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wekan",
|
||||
"version": "1.47.0",
|
||||
"version": "1.46.0",
|
||||
"description": "The open-source kanban",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
|
|||
appTitle = (defaultText = "Wekan"),
|
||||
# The name of the app as it is displayed to the user.
|
||||
|
||||
appVersion = 132,
|
||||
appVersion = 131,
|
||||
# Increment this for every release.
|
||||
|
||||
appMarketingVersion = (defaultText = "1.47.0~2018-09-16"),
|
||||
appMarketingVersion = (defaultText = "1.46.0~2018-09-15"),
|
||||
# Human-readable presentation of the app version.
|
||||
|
||||
minUpgradableAppVersion = 0,
|
||||
|
|
|
@ -39,5 +39,3 @@ Meteor.startup(() => {
|
|||
}, 30000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
Meteor.publish('rules', (ruleId) => {
|
||||
check(ruleId, String);
|
||||
return Rules.find({
|
||||
_id: ruleId,
|
||||
});
|
||||
});
|
||||
|
||||
Meteor.publish('allRules', () => {
|
||||
return Rules.find({});
|
||||
});
|
||||
|
||||
Meteor.publish('allTriggers', () => {
|
||||
return Triggers.find({});
|
||||
});
|
||||
|
||||
Meteor.publish('allActions', () => {
|
||||
return Actions.find({});
|
||||
});
|
|
@ -1,131 +0,0 @@
|
|||
RulesHelper = {
|
||||
executeRules(activity){
|
||||
const matchingRules = this.findMatchingRules(activity);
|
||||
for(let i = 0; i< matchingRules.length; i++){
|
||||
const action = matchingRules[i].getAction();
|
||||
this.performAction(activity, action);
|
||||
}
|
||||
},
|
||||
findMatchingRules(activity){
|
||||
const activityType = activity.activityType;
|
||||
if(TriggersDef[activityType] === undefined){
|
||||
return [];
|
||||
}
|
||||
const matchingFields = TriggersDef[activityType].matchingFields;
|
||||
const matchingMap = this.buildMatchingFieldsMap(activity, matchingFields);
|
||||
const matchingTriggers = Triggers.find(matchingMap);
|
||||
const matchingRules = [];
|
||||
matchingTriggers.forEach(function(trigger){
|
||||
matchingRules.push(trigger.getRule());
|
||||
});
|
||||
return matchingRules;
|
||||
},
|
||||
buildMatchingFieldsMap(activity, matchingFields){
|
||||
const matchingMap = {'activityType':activity.activityType};
|
||||
for(let i = 0; i< matchingFields.length; i++){
|
||||
// Creating a matching map with the actual field of the activity
|
||||
// and with the wildcard (for example: trigger when a card is added
|
||||
// in any [*] board
|
||||
matchingMap[matchingFields[i]] = { $in: [activity[matchingFields[i]], '*']};
|
||||
}
|
||||
return matchingMap;
|
||||
},
|
||||
performAction(activity, action){
|
||||
const card = Cards.findOne({_id:activity.cardId});
|
||||
const boardId = activity.boardId;
|
||||
if(action.actionType === 'moveCardToTop'){
|
||||
let listId;
|
||||
let list;
|
||||
if(activity.listTitle === '*'){
|
||||
listId = card.swimlaneId;
|
||||
list = card.list();
|
||||
}else{
|
||||
list = Lists.findOne({title: action.listTitle, boardId });
|
||||
listId = list._id;
|
||||
}
|
||||
const minOrder = _.min(list.cards(card.swimlaneId).map((c) => c.sort));
|
||||
card.move(card.swimlaneId, listId, minOrder - 1);
|
||||
}
|
||||
if(action.actionType === 'moveCardToBottom'){
|
||||
let listId;
|
||||
let list;
|
||||
if(activity.listTitle === '*'){
|
||||
listId = card.swimlaneId;
|
||||
list = card.list();
|
||||
}else{
|
||||
list = Lists.findOne({title: action.listTitle, boardId});
|
||||
listId = list._id;
|
||||
}
|
||||
const maxOrder = _.max(list.cards(card.swimlaneId).map((c) => c.sort));
|
||||
card.move(card.swimlaneId, listId, maxOrder + 1);
|
||||
}
|
||||
if(action.actionType === 'sendEmail'){
|
||||
const emailTo = action.emailTo;
|
||||
const emailMsg = action.emailMsg;
|
||||
const emailSubject = action.emailSubject;
|
||||
try {
|
||||
Email.send({
|
||||
to,
|
||||
from: Accounts.emailTemplates.from,
|
||||
subject,
|
||||
text,
|
||||
});
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(action.actionType === 'archive'){
|
||||
card.archive();
|
||||
}
|
||||
if(action.actionType === 'unarchive'){
|
||||
card.restore();
|
||||
}
|
||||
if(action.actionType === 'addLabel'){
|
||||
card.addLabel(action.labelId);
|
||||
}
|
||||
if(action.actionType === 'removeLabel'){
|
||||
card.removeLabel(action.labelId);
|
||||
}
|
||||
if(action.actionType === 'addMember'){
|
||||
const memberId = Users.findOne({username:action.memberName})._id;
|
||||
card.assignMember(memberId);
|
||||
}
|
||||
if(action.actionType === 'removeMember'){
|
||||
if(action.memberName === '*'){
|
||||
const members = card.members;
|
||||
for(let i = 0; i< members.length; i++){
|
||||
card.unassignMember(members[i]);
|
||||
}
|
||||
}else{
|
||||
const memberId = Users.findOne({username:action.memberName})._id;
|
||||
card.unassignMember(memberId);
|
||||
}
|
||||
}
|
||||
if(action.actionType === 'checkAll'){
|
||||
const checkList = Checklists.findOne({'title':action.checklistName, 'cardId':card._id});
|
||||
checkList.checkAllItems();
|
||||
}
|
||||
if(action.actionType === 'uncheckAll'){
|
||||
const checkList = Checklists.findOne({'title':action.checklistName, 'cardId':card._id});
|
||||
checkList.uncheckAllItems();
|
||||
}
|
||||
if(action.actionType === 'checkItem'){
|
||||
const checkList = Checklists.findOne({'title':action.checklistName, 'cardId':card._id});
|
||||
const checkItem = ChecklistItems.findOne({'title':action.checkItemName, 'checkListId':checkList._id});
|
||||
checkItem.check();
|
||||
}
|
||||
if(action.actionType === 'uncheckItem'){
|
||||
const checkList = Checklists.findOne({'title':action.checklistName, 'cardId':card._id});
|
||||
const checkItem = ChecklistItems.findOne({'title':action.checkItemName, 'checkListId':checkList._id});
|
||||
checkItem.uncheck();
|
||||
}
|
||||
if(action.actionType === 'addChecklist'){
|
||||
Checklists.insert({'title':action.checklistName, 'cardId':card._id, 'sort':0});
|
||||
}
|
||||
if(action.actionType === 'removeChecklist'){
|
||||
Checklists.remove({'title':action.checklistName, 'cardId':card._id, 'sort':0});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
};
|
|
@ -1,58 +0,0 @@
|
|||
TriggersDef = {
|
||||
createCard:{
|
||||
matchingFields: ['boardId', 'listName'],
|
||||
},
|
||||
moveCard:{
|
||||
matchingFields: ['boardId', 'listName', 'oldListName'],
|
||||
},
|
||||
archivedCard:{
|
||||
matchingFields: ['boardId'],
|
||||
},
|
||||
restoredCard:{
|
||||
matchingFields: ['boardId'],
|
||||
},
|
||||
joinMember:{
|
||||
matchingFields: ['boardId', 'memberId'],
|
||||
},
|
||||
unjoinMember:{
|
||||
matchingFields: ['boardId', 'memberId'],
|
||||
},
|
||||
addChecklist:{
|
||||
matchingFields: ['boardId', 'checklistName'],
|
||||
},
|
||||
removeChecklist:{
|
||||
matchingFields: ['boardId', 'checklistName'],
|
||||
},
|
||||
completeChecklist:{
|
||||
matchingFields: ['boardId', 'checklistName'],
|
||||
},
|
||||
uncompleteChecklist:{
|
||||
matchingFields: ['boardId', 'checklistName'],
|
||||
},
|
||||
addedChecklistItem:{
|
||||
matchingFields: ['boardId', 'checklistItemName'],
|
||||
},
|
||||
removedChecklistItem:{
|
||||
matchingFields: ['boardId', 'checklistItemName'],
|
||||
},
|
||||
checkedItem:{
|
||||
matchingFields: ['boardId', 'checklistItemName'],
|
||||
},
|
||||
uncheckedItem:{
|
||||
matchingFields: ['boardId', 'checklistItemName'],
|
||||
},
|
||||
addAttachment:{
|
||||
matchingFields: ['boardId'],
|
||||
},
|
||||
deleteAttachment:{
|
||||
matchingFields: ['boardId'],
|
||||
},
|
||||
addedLabel:{
|
||||
matchingFields: ['boardId', 'labelId'],
|
||||
},
|
||||
removedLabel:{
|
||||
matchingFields: ['boardId', 'labelId'],
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue