summaryrefslogtreecommitdiffstats
path: root/client/components/rules/rulesTriggers.js
blob: a502fd373740969842ed6319317ffa306846a7ce (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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'() {
          this.setBoardTriggers();
        },
        'click .js-set-card-triggers'() {
          this.setCardTriggers();
        },
        'click .js-set-checklist-triggers'() {
          this.setChecklistTriggers();
        },
      },
    ];
  },
}).register('rulesTriggers');