wekan/client/components/rules/actions/mailActions.js

36 lines
931 B
JavaScript
Raw Normal View History

2018-08-19 18:53:50 +02:00
BlazeComponent.extendComponent({
onCreated() {
},
events() {
2018-09-14 17:39:37 +02:00
return [{
'click .js-mail-action' (event) {
const emailTo = this.find('#email-to').value;
const emailSubject = this.find('#email-subject').value;
const emailMsg = this.find('#email-msg').value;
const trigger = this.data().triggerVar.get();
const ruleName = this.data().ruleName.get();
const triggerId = Triggers.insert(trigger);
const boardId = Session.get('currentBoard');
const desc = Utils.getTriggerActionDesc(event, this);
const actionId = Actions.insert({
2018-09-16 01:50:36 +03:00
actionType: 'sendEmail',
emailTo,
emailSubject,
emailMsg,
boardId,
desc,
2018-09-14 17:39:37 +02:00
});
Rules.insert({
title: ruleName,
2018-09-16 01:50:36 +03:00
triggerId,
actionId,
boardId,
2018-09-14 17:39:37 +02:00
});
},
}];
},
2018-08-19 18:53:50 +02:00
2018-09-16 01:50:36 +03:00
}).register('mailActions');