mirror of
https://github.com/wekan/wekan.git
synced 2025-04-24 22:17:16 -04:00
Add and remove ui
This commit is contained in:
parent
f63482b587
commit
7e4bd4a0a7
3 changed files with 36 additions and 21 deletions
|
@ -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")
|
||||
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue