summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Gallarello <angelo.gallarell@gmail.com>2018-08-03 20:43:37 +0200
committerAngelo Gallarello <angelo.gallarell@gmail.com>2018-08-03 20:43:37 +0200
commit7e4bd4a0a753531c2716ff39ce88f05b7fc30c0d (patch)
treed826ff275419313bb81ad18802da96f4ecbd93c0
parentf63482b58775a2f52fdd5f932ce7d14f16757133 (diff)
downloadwekan-7e4bd4a0a753531c2716ff39ce88f05b7fc30c0d.tar.gz
wekan-7e4bd4a0a753531c2716ff39ce88f05b7fc30c0d.tar.bz2
wekan-7e4bd4a0a753531c2716ff39ce88f05b7fc30c0d.zip
Add and remove ui
-rw-r--r--client/components/rules/rules.jade10
-rw-r--r--client/components/rules/rules.js30
-rw-r--r--models/rules.js17
3 files changed, 36 insertions, 21 deletions
diff --git a/client/components/rules/rules.jade b/client/components/rules/rules.jade
index 8f482b06..6b49b5a7 100644
--- a/client/components/rules/rules.jade
+++ b/client/components/rules/rules.jade
@@ -5,23 +5,23 @@ template(name="rules")
| Project rules
ul.rules-lists
- each triggers
+ each rules
li.rules-lists-item
p
- = toId
+ = title
div.rules-btns-group
button
i.fa.fa-eye
| View rule
- button
+ button.js-delete-rule
i.fa.fa-trash-o
| Delete rule
else
li.no-items-message No rules
div.rules-add
- button
+ button.js-add-rule
i.fa.fa-plus
| Add rule
- input(type=text)
+ input(type=text,placeholder="New rule name",id="ruleTitle")
diff --git a/client/components/rules/rules.js b/client/components/rules/rules.js
index e679431a..ed781f9a 100644
--- a/client/components/rules/rules.js
+++ b/client/components/rules/rules.js
@@ -1,25 +1,25 @@
BlazeComponent.extendComponent({
onCreated() {
- this.subscribe('allTriggers');
+ this.subscribe('allRules');
},
- triggers() {
- return Triggers.find({});
+ rules() {
+ return Rules.find({});
},
events() {
- return [{'click .js-add-trigger'(event) {
+ return [{'click .js-delete-rule'(event) {
+ const rule = this.currentData();
+ Rules.remove(rule._id);
+
+ },
+ 'click .js-add-rule'(event) {
event.preventDefault();
- const toName = this.find('#toName').value;
- const fromName = this.find('#fromName').value;
- const toId = Triggers.findOne().findList(toName)._id;
- const fromId = Triggers.findOne().findList(fromName)._id;
- console.log(toId);
- console.log(fromId);
- Triggers.insert({group: "cards", activityType: "moveCard","fromId":fromId,"toId":toId });
-
+ const ruleTitle = this.find('#ruleTitle').value;
+ Rules.insert({title: ruleTitle});
+ this.find('#ruleTitle').value = "";
- },}];
- },
-}).register('rules');
+ }}];
+ },
+ }).register('rules');
diff --git a/models/rules.js b/models/rules.js
index 2304d2dc..df0cccea 100644
--- a/models/rules.js
+++ b/models/rules.js
@@ -5,7 +5,11 @@ Rules.attachSchema(new SimpleSchema({
type: String,
optional: true,
},
- description: {
+ triggerId: {
+ type: String,
+ optional: true,
+ },
+ actionId: {
type: String,
optional: true,
},
@@ -17,11 +21,22 @@ Rules.mutations({
},
});
+
+
+
Rules.allow({
update: function () {
// add custom authentication code here
return true;
},
+ remove: function () {
+ // add custom authentication code here
+ return true;
+ },
+ insert: function () {
+ // add custom authentication code here
+ return true;
+ },
});