summaryrefslogtreecommitdiffstats
path: root/client/components/rules/triggers/boardTriggers.js
blob: 08274777800d2f377c7f2716d3d695d6060fbf61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
BlazeComponent.extendComponent({
  onCreated() {

  },

  events() {
    return [
    {'click .js-add-gen-trigger'(event) {

      let datas = this.data();
      const actionSelected = this.find('#action').value;
      const boardId = Session.get('currentBoard')
      if(actionSelected == "created"){
        Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
          datas.triggerIdVar.set(id);
        });
      }
      if(actionSelected == "removed"){
        Triggers.insert({activityType: "removeCard","boardId":boardId},function(error,id){
          datas.triggerIdVar.set(id);
        });
      }

    },
    }];
  },

}).register('boardTriggers');