blob: 9bca34607cc3bf177e1ad26c4d74984aad770531 (
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
|
BlazeComponent.extendComponent({
onCreated() {
this.rulesListVar = new ReactiveVar(true);
this.rulesTriggerVar = new ReactiveVar(false);
this.ruleName = new ReactiveVar("");
},
setTrigger() {
this.rulesListVar.set(false);
this.rulesTriggerVar.set(true);
},
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 = "";
this.ruleName.set(ruleTitle)
this.setTrigger();
}}];
},
}).register('rules');
BlazeComponent.extendComponent({
onCreated() {
this.subscribe('allRules');
},
rules() {
return Rules.find({});
},
events() {
return [{}];
},
}).register('rulesList');
|