summaryrefslogtreecommitdiffstats
path: root/client/components/rules/actions/mailActions.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/rules/actions/mailActions.js')
-rw-r--r--client/components/rules/actions/mailActions.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/client/components/rules/actions/mailActions.js b/client/components/rules/actions/mailActions.js
new file mode 100644
index 00000000..dae7d08d
--- /dev/null
+++ b/client/components/rules/actions/mailActions.js
@@ -0,0 +1,35 @@
+BlazeComponent.extendComponent({
+ onCreated() {
+
+ },
+
+ events() {
+ 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({
+ actionType: "sendEmail",
+ "emailTo": emailTo,
+ "emailSubject": emailSubject,
+ "emailMsg": emailMsg,
+ "boardId": boardId,
+ "desc": desc
+ });
+ Rules.insert({
+ title: ruleName,
+ triggerId: triggerId,
+ actionId: actionId,
+ "boardId": boardId
+ });
+ },
+ }];
+ },
+
+}).register('mailActions'); \ No newline at end of file