summaryrefslogtreecommitdiffstats
path: root/client/components/rules/triggers
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-09-16 00:10:40 +0300
committerLauri Ojansivu <x@xet7.org>2018-09-16 00:10:40 +0300
commit6673b79738720651f186039808d4e22ef14e4c3c (patch)
tree464eb186f382f14b93c9c9ca7b21a14851746770 /client/components/rules/triggers
parent053757f135b54241b4899a83cd3bb749b1e81bc9 (diff)
parent36c04edb9f7cf16fb450b76598c4957968d4674b (diff)
downloadwekan-6673b79738720651f186039808d4e22ef14e4c3c.tar.gz
wekan-6673b79738720651f186039808d4e22ef14e4c3c.tar.bz2
wekan-6673b79738720651f186039808d4e22ef14e4c3c.zip
Merge branch 'feature-rules' of https://github.com/Angtrim/wekan into Angtrim-feature-rules
Diffstat (limited to 'client/components/rules/triggers')
-rw-r--r--client/components/rules/triggers/boardTriggers.jade61
-rw-r--r--client/components/rules/triggers/boardTriggers.js103
-rw-r--r--client/components/rules/triggers/cardTriggers.jade79
-rw-r--r--client/components/rules/triggers/cardTriggers.js130
-rw-r--r--client/components/rules/triggers/checklistTriggers.jade83
-rw-r--r--client/components/rules/triggers/checklistTriggers.js146
6 files changed, 602 insertions, 0 deletions
diff --git a/client/components/rules/triggers/boardTriggers.jade b/client/components/rules/triggers/boardTriggers.jade
new file mode 100644
index 00000000..b5e08c8c
--- /dev/null
+++ b/client/components/rules/triggers/boardTriggers.jade
@@ -0,0 +1,61 @@
+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
+
+
+
+
+
+
+
diff --git a/client/components/rules/triggers/boardTriggers.js b/client/components/rules/triggers/boardTriggers.js
new file mode 100644
index 00000000..95c10a5b
--- /dev/null
+++ b/client/components/rules/triggers/boardTriggers.js
@@ -0,0 +1,103 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+
+ },
+
+ events() {
+ return [{
+ 'click .js-add-gen-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#gen-action').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "created") {
+ datas.triggerVar.set({
+ activityType: "createCard",
+ "boardId": boardId,
+ "listName": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removeCard",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+
+ },
+ 'click .js-add-create-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "listName": listName,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removeCard",
+ "boardId": boardId,
+ "listName": listName,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-moved-trigger' (event) {
+ let 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": boardId,
+ "listName": listName,
+ "oldListName": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "moved-from") {
+ datas.triggerVar.set({
+ activityType: "moveCard",
+ "boardId": boardId,
+ "listName": "*",
+ "oldListName": listName,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-arc-trigger' (event) {
+ let 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": boardId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "unarchived") {
+ datas.triggerVar.set({
+ activityType: "restoredCard",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+ }
+
+ }];
+ },
+
+}).register('boardTriggers'); \ No newline at end of file
diff --git a/client/components/rules/triggers/cardTriggers.jade b/client/components/rules/triggers/cardTriggers.jade
new file mode 100644
index 00000000..dd02413c
--- /dev/null
+++ b/client/components/rules/triggers/cardTriggers.jade
@@ -0,0 +1,79 @@
+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 \ No newline at end of file
diff --git a/client/components/rules/triggers/cardTriggers.js b/client/components/rules/triggers/cardTriggers.js
new file mode 100644
index 00000000..c0a5ec1a
--- /dev/null
+++ b/client/components/rules/triggers/cardTriggers.js
@@ -0,0 +1,130 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.subscribe('allRules');
+ },
+ labels() {
+ const labels = Boards.findOne(Session.get('currentBoard')).labels;
+ console.log(labels);
+ for (let i = 0; i < labels.length; i++) {
+ if (labels[i].name == "" || labels[i].name == undefined) {
+ labels[i].name = labels[i].color.toUpperCase();
+ }
+ }
+ console.log(labels);
+ return labels;
+ },
+ events() {
+ return [{
+ 'click .js-add-gen-label-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#label-action').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "added") {
+ datas.triggerVar.set({
+ activityType: "addedLabel",
+ "boardId": boardId,
+ "labelId": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removedLabel",
+ "boardId": boardId,
+ "labelId": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-label-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "labelId": labelId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removedLabel",
+ "boardId": boardId,
+ "labelId": labelId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-gen-member-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "memberId": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "unjoinMember",
+ "boardId": boardId,
+ "memberId": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-member-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "memberId": memberId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "unjoinMember",
+ "boardId": boardId,
+ "memberId": memberId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-attachment-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let datas = this.data();
+ const actionSelected = this.find('#attach-action').value;
+ const boardId = Session.get('currentBoard')
+ if (actionSelected == "added") {
+ datas.triggerVar.set({
+ activityType: "addAttachment",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "deleteAttachment",
+ "boardId": boardId,
+ "desc": desc
+ });
+ }
+ },
+ }];
+ },
+}).register('cardTriggers'); \ No newline at end of file
diff --git a/client/components/rules/triggers/checklistTriggers.jade b/client/components/rules/triggers/checklistTriggers.jade
new file mode 100644
index 00000000..465713c8
--- /dev/null
+++ b/client/components/rules/triggers/checklistTriggers.jade
@@ -0,0 +1,83 @@
+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 \ No newline at end of file
diff --git a/client/components/rules/triggers/checklistTriggers.js b/client/components/rules/triggers/checklistTriggers.js
new file mode 100644
index 00000000..6e7b3445
--- /dev/null
+++ b/client/components/rules/triggers/checklistTriggers.js
@@ -0,0 +1,146 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+ this.subscribe('allRules');
+ },
+ events() {
+ return [{
+ 'click .js-add-gen-check-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "checklistName": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removeChecklist",
+ "boardId": boardId,
+ "checklistName": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-check-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "checklistName": checklistId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "removeChecklist",
+ "boardId": boardId,
+ "checklistName": checklistId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-gen-comp-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+
+ let 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": boardId,
+ "checklistName": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "uncompleted") {
+ datas.triggerVar.set({
+ activityType: "uncompleteChecklist",
+ "boardId": boardId,
+ "checklistName": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-comp-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "checklistName": checklistId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "removed") {
+ datas.triggerVar.set({
+ activityType: "uncompleteChecklist",
+ "boardId": boardId,
+ "checklistName": checklistId,
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-gen-check-item-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "checklistItemName": "*",
+ "desc": desc
+ });
+ }
+ if (actionSelected == "unchecked") {
+ datas.triggerVar.set({
+ activityType: "uncheckedItem",
+ "boardId": boardId,
+ "checklistItemName": "*",
+ "desc": desc
+ });
+ }
+ },
+ 'click .js-add-spec-check-item-trigger' (event) {
+ const desc = Utils.getTriggerActionDesc(event, this);
+ let 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": boardId,
+ "checklistItemName": checklistItemId,
+ "desc": desc
+ });
+ }
+ if (actionSelected == "unchecked") {
+ datas.triggerVar.set({
+ activityType: "uncheckedItem",
+ "boardId": boardId,
+ "checklistItemName": checklistItemId,
+ "desc": desc
+ });
+ }
+ },
+ }];
+ },
+
+}).register('checklistTriggers'); \ No newline at end of file