summaryrefslogtreecommitdiffstats
path: root/client/components/rules/rules.js
blob: ed781f9a54f9c3262dddba5e9d234c2e16d3a419 (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
BlazeComponent.extendComponent({
  onCreated() {
    this.subscribe('allRules');
  },

  rules() {
    return Rules.find({});
  },
  events() {
    return [{'click .js-delete-rule'(event) {
          const rule = this.currentData();
          Rules.remove(rule._id);
          
        },
        'click .js-add-rule'(event) {

          event.preventDefault();
          const ruleTitle = this.find('#ruleTitle').value;
          Rules.insert({title: ruleTitle});
          this.find('#ruleTitle').value = "";
          
        }}];
      },
    }).register('rules');