Added initial support for trigger based automation

This commit is contained in:
Andris Reinman 2016-06-03 13:15:33 +03:00
parent cc1c70d57f
commit b16209f23e
36 changed files with 2025 additions and 263 deletions

View file

@ -9,8 +9,9 @@
Create Campaign <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="/campaigns/create"><i class="glyphicon glyphicon-plus"></i> Normal Campaign</a></li>
<li><a href="/campaigns/create?type=rss"><i class="glyphicon glyphicon-signal"></i> RSS Campaign</a></li>
<li><a href="/campaigns/create"><i class="glyphicon glyphicon-plus"></i> Normal Campaign</a></li>
<li><a href="/campaigns/create?type=rss"><i class="glyphicon glyphicon-signal"></i> RSS Campaign</a></li>
<li><a href="/campaigns/create?type=triggered"><i class="glyphicon glyphicon-console"></i> Triggered Campaign</a></li>
</ul>
</div>
</div>

View file

@ -0,0 +1,110 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/campaigns">Campaigns</a></li>
<li class="active">Create Triggered Campaign</li>
</ol>
<h2>Create Triggered Campaign</h2>
<hr>
<form class="form-horizontal" method="post" action="/campaigns/create">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="type" value="triggered">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-lg" name="name" id="name" value="{{name}}" placeholder="Campaign Name" autofocus required>
</div>
</div>
<div class="form-group">
<label for="description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="description" id="description">{{description}}</textarea>
<span class="help-block">HTML is allowed</span>
</div>
</div>
<div class="form-group">
<label for="list" class="col-sm-2 control-label">List</label>
<div class="col-sm-10">
<select class="form-control" id="list" name="list" required>
<option value=""> Select </option>
{{#each listItems}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>
{{name}} <span class="text-muted"> &mdash; {{subscribers}} subscribers</span>
</option>
{{#if segments}}
<optgroup label="{{name}} segments">
{{#each segments}}
<option value="{{../id}}:{{id}}" {{#if selected}} selected {{/if}}>
{{../name}}: {{name}}
</option>
{{/each}}
</optgroup>
{{/if}}
{{/each}}
</select>
</div>
</div>
<div class="form-group">
<label for="template" class="col-sm-2 control-label">Template</label>
<div class="col-sm-10">
<p class="form-control-static">
Select a template:
</p>
<div>
<select class="form-control" id="template" name="template">
<option value=""> Select </option>
{{#each templateItems}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>
{{name}}
</option>
{{/each}}
</select>
<span class="help-block">Selecting a template creates a campaign specific copy from it</span>
</div>
<p class="form-control-static">
Or alternatively use an URL as the message content source:
</p>
<div>
<input type="url" class="form-control" name="source-url" id="source-url" value="{{sourceUrl}}" placeholder="http://example.com/message-render.php">
<span class="help-block">If a message is sent then this URL will be POSTed to using Merge Tags as POST body. Use this if you want to generate the HTML message yourself</span>
</div>
</div>
</div>
<hr />
<div class="form-group">
<label for="from" class="col-sm-2 control-label">Email "from name"</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="from" id="from" value="{{from}}" placeholder="This is the name your emails will come from" required>
</div>
</div>
<div class="form-group">
<label for="address" class="col-sm-2 control-label">Email "from" address</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="address" id="address" value="{{address}}" placeholder="This is the address people will send replies to" required>
</div>
</div>
<div class="form-group">
<label for="subject" class="col-sm-2 control-label">Email "subject line"</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subject" id="subject" value="{{subject}}" placeholder="Keep it relevant and non-spammy" required>
</div>
</div>
<hr />
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Create Campaign</button>
</div>
</div>
</form>

View file

@ -0,0 +1,196 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/campaigns">Campaigns</a></li>
{{#if parent}}
<li><a href="/campaigns/view/{{parent.id}}">{{parent.name}}</a></li>
{{/if}}
<li><a href="/campaigns/view/{{id}}">{{name}}</a></li>
<li class="active">Edit Triggered Campaign</li>
</ol>
<h2>Edit Triggered Campaign <a class="btn btn-default btn-xs" href="/campaigns/view/{{id}}" role="button"><span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> View campaign</a></h2>
<hr>
<form method="post" class="delete-form" id="campaigns-delete" action="/campaigns/delete">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="id" value="{{id}}" />
</form>
<form class="form-horizontal" method="post" action="/campaigns/edit">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="id" value="{{id}}" />
<input type="hidden" name="type" value="triggered" />
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="{{#if showGeneral}}active{{/if}}"><a href="#general" aria-controls="general" role="tab" data-toggle="tab">General</a></li>
<li role="presentation" class="{{#if showTemplate}}active{{/if}}"><a href="#template" aria-controls="template" role="tab" data-toggle="tab">Template</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane {{#if showGeneral}}active{{/if}}" id="general">
<p></p>
<fieldset>
<legend>
General Settings
</legend>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-lg" name="name" id="name" value="{{name}}" placeholder="Campaign Name" autofocus required>
</div>
</div>
<div class="form-group">
<label for="description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" name="description" id="description">{{description}}</textarea>
<span class="help-block">HTML is allowed</span>
</div>
</div>
<div class="form-group">
<label for="list" class="col-sm-2 control-label">List</label>
<div class="col-sm-10">
<select class="form-control" id="list" name="list" required>
<option value=""> Select </option>
{{#each listItems}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>
{{name}} <span class="text-muted"> &mdash; {{subscribers}} subscribers</span>
</option>
{{#if segments}}
<optgroup label="{{name}} segments">
{{#each segments}}
<option value="{{../id}}:{{id}}" {{#if selected}} selected {{/if}}>
{{../name}}: {{name}}
</option>
{{/each}}
</optgroup>
{{/if}}
{{/each}}
</select>
</div>
</div>
<hr />
<div class="form-group">
<label for="from" class="col-sm-2 control-label">Email "from name"</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="from" id="from" value="{{from}}" placeholder="This is the name your emails will come from" required>
</div>
</div>
<div class="form-group">
<label for="address" class="col-sm-2 control-label">Email "from" address</label>
<div class="col-sm-10">
<input type="email" class="form-control" name="address" id="address" value="{{address}}" placeholder="This is the address people will send replies to" required>
</div>
</div>
<div class="form-group">
<label for="subject" class="col-sm-2 control-label">Email "subject line"</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subject" id="subject" value="{{subject}}" placeholder="Keep it relevant and non-spammy" required>
</div>
</div>
</fieldset>
</div>
<div role="tabpanel" class="tab-pane {{#if showTemplate}}active{{/if}}" id="template">
<p></p>
<fieldset>
<legend>
Template Settings
</legend>
{{#if sourceUrl}}
<div class="form-group">
<label for="source-url" class="col-sm-2 control-label">Template URL</label>
<div class="col-sm-10">
<input type="url" class="form-control" name="source-url" id="source-url" value="{{sourceUrl}}" placeholder="http://example.com/message-render.php">
<span class="help-block">If a message is sent then this URL will be POSTed to using Merge Tags as POST body. Use this if you want to generate the HTML message yourself</span>
</div>
</div>
{{else}}
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<a class="btn btn-default" role="button" data-toggle="collapse" href="#mergeReference" aria-expanded="false" aria-controls="mergeReference">Merge tag reference</a>
<div class="collapse" id="mergeReference">
<p>
Merge tags are tags that are replaced before sending out the message. The format of the merge tag is the following: <code>[TAG_NAME]</code> or <code>[TAG_NAME/fallback]</code> where <code>fallback</code> is an optional
text value used when <code>TAG_NAME</code> is empty.
</p>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th>
Merge tag
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
{{#each mergeTags}}
<tr>
<th scope="row">
[{{key}}]
</th>
<td>
{{value}}
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</div>
<div class="form-group">
<label for="template-html" class="col-sm-2 control-label">Template content (HTML)</label>
<div class="col-sm-10">
{{#if disableWysiwyg}}
<div class="code-editor" id="template-html">{{html}}</div>
<input type="hidden" name="html">
{{else}}
<textarea class="form-control summernote" id="template-html" name="html" rows="8">{{html}}</textarea>
{{/if}}
</div>
</div>
<div class="form-group">
<label for="template-text" class="col-sm-2 control-label">Template content (plaintext)</label>
<div class="col-sm-10">
<textarea class="form-control" id="template-text" name="text" rows="10">{{text}}</textarea>
</div>
</div>
{{/if}}
</fieldset>
</div>
</div>
</div>
<hr />
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="pull-right">
<button type="submit" form="campaigns-delete" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i> Delete Campaign</button>
</div>
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-ok"></i> Update</button>
</div>
</div>
</form>

View file

@ -33,27 +33,25 @@
<p></p>
<dl class="dl-horizontal">
<dt>List</dt>
<dd>
{{#if segment}}
<a href="/lists/view/{{list.id}}?segment={{segment.id}}">
{{list.name}}: {{segment.name}}
</a>
{{else}}
<a href="/lists/view/{{list.id}}">
{{list.name}}
</a>
{{/if}}
</dd>
{{#if list}}
<dt>List</dt>
<dd>
{{#if segment}}
<a href="/lists/view/{{list.id}}?segment={{segment.id}}">{{list.name}}: {{segment.name}}</a>
{{else}}
<a href="/lists/view/{{list.id}}">{{list.name}}</a>
{{/if}}
</dd>
<dt>List subscribers</dt>
<dd>
{{#if segment}}
{{segment.subscribers}}
{{else}}
{{list.subscribers}}
{{/if}}
</dd>
<dt>List subscribers</dt>
<dd>
{{#if segment}}
{{segment.subscribers}}
{{else}}
{{list.subscribers}}
{{/if}}
</dd>
{{/if}}
{{#if isRss}}
<dt>Feed URL</dt>
@ -85,7 +83,7 @@
<dd>{{subject}}</dd>
{{/if}}
{{#if isNormal}}
{{#unless isRss}}
<dt>Preview campaign as</dt>
<dd>
@ -166,7 +164,7 @@
</dd>
{{/unless}}
{{/if}}
{{/unless}}
</dl>
{{#if isNormal}}
@ -313,6 +311,14 @@
</div>
{{/if}}
{{#if isTriggered}}
<div class="panel panel-default">
<div class="panel-body">
This is a <a href="/triggers">triggered</a> campaign. Messages are only sent to subscribers that hit some trigger that invokes this campaign
</div>
</div>
{{/if}}
</div>
{{#if links}}
<div role="tabpanel" class="tab-pane {{#if showLinks}}active{{/if}}" id="links">

View file

@ -1,11 +1,11 @@
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger fade in" role=alert>
<h4>Oh snap! I'm running a crowdfunding campaign!</h4>
<p>I'm running an IndieGoGo campaign to help fund developing first class automation support into Mailtrain and You can make it possible! Alternatively you can donate to the Mailtrain project directly with Paypal. If you prefer Bitcoin, then my
wallet address is <code>15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM</code></p>
<h4>Donate to author</h4>
<p>If you really like Mailtrain then you can donate to the Mailtrain project to support the further development of it. You can donate directly with Paypal or if you prefer Bitcoin, then my wallet address is <code>15Z8ADxhssKUiwP3jbbqJwA21744KMCfTM</code>.</p>
<p>If you are a business and can't donate because of tax reasons then I can sell you the Mailtrain license (GPL) with an invoice, just send me an email (<a href="andris@mailtrain.org">andris@mailtrain.org</a>) with the sum you are willing to pay for the license and I'll return an invoice
for it.</p>
<p>
<a href="https://igg.me/at/mailtrain/8720095" class="btn btn-info">Support the Campaign</a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=DB26KWR2BQX5W" class="btn btn-info">Donate using PayPal</a>
</p>
</div>

View file

@ -108,11 +108,11 @@
{{#if indexPage}}
<div class="jumbotron">
<div class="container">
<div class="pull-right hidden-xs">
<img class="img-responsive" src="/mailtrain.png">
<div class="pull-right col-md-4">
{{{shoutout}}}
</div>
<h1>Mailtrain</h1>
<h1><img class="img-responsive" src="/mailtrain-header.png"></h1>
<p>Self hosted newsletter app built on top of <a href="http://nodemailer.com">Nodemailer</a></p>
<p>
<a class="btn btn-info btn-md" href="https://github.com/andris9/mailtrain" role="button"><span class="glyphicon glyphicon-cloud-download" aria-hidden="true"></span> Source on GitHub</a>
@ -121,9 +121,6 @@
</p>
<div class="clearfix"></div>
<div class="visible-xs-block ">
<img class="img-responsive" src="/mailtrain.png">
</div>
</div>
</div>
{{/if}}

View file

@ -16,6 +16,7 @@
<li><a href="/fields/{{id}}" role="button"><span class="glyphicon glyphicon-tasks" aria-hidden="true"></span> Custom Fields</a></li>
<li><a href="/segments/{{id}}" role="button"><span class="glyphicon glyphicon-filter" aria-hidden="true"></span> Segments</a></li>
<li><a href="/lists/edit/{{id}}" role="button"><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> Edit List</a></li>
<li><a href="/triggers/{{id}}/create" role="button"><span class="glyphicon glyphicon-console" aria-hidden="true"></span> Create Trigger</a></li>
<li role="separator" class="divider"></li>
<li><a href="/lists/subscription/{{id}}/add" role="button"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add Subscriber</a></li>
<li><a href="/lists/subscription/{{id}}/import" role="button"><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span> Import Subscribers</a></li>

View file

@ -55,6 +55,14 @@
</div>
</div>
<div class="form-group">
<label for="shoutout" class="col-sm-2 control-label">Frontpage shout out</label>
<div class="col-sm-10">
<textarea class="form-control gpg-text" rows="3" id="shoutout" name="shoutout" placeholder="">{{shoutout}}</textarea>
<span class="help-block">HTML code shown in the front page header section</span>
</div>
</div>
</fieldset>
<fieldset>

View file

@ -46,6 +46,15 @@
<li>
<code>[LINK_BROWSER]</code> URL to preview the message in a browser
</li>
<li>
<code>[SUBSCRIPTION_ID]</code> Unique ID that identifies the recipient
</li>
<li>
<code>[LIST_ID]</code> Unique ID that identifies the list used for this campaign
</li>
<li>
<code>[CAMPAIGN_ID]</code> Unique ID that identifies current campaign
</li>
</ul>
<p>
In addition to that any custom field can have its own merge tag.

View file

@ -0,0 +1,33 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/triggers/">Automation Triggers</a></li>
<li class="active">Create Trigger</li>
</ol>
<h2>Create Trigger <small>Select a list for the trigger</small></h2>
<hr>
<form class="form-horizontal" method="post" action="/triggers/create-select">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<div class="form-group">
<label for="group" class="col-sm-2 control-label">List</label>
<div class="col-sm-10">
<select class="form-control" name="list" required>
<option value=""> Select </option>
{{#each listItems}}
<option value="{{id}}">
{{name}} <span class="text-muted"> &mdash; {{subscribers}} subscribers</span>
</option>
{{/each}}
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-triangle-right"></i> Next</button>
</div>
</div>
</form>

162
views/triggers/create.hbs Normal file
View file

@ -0,0 +1,162 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/triggers/">Automation Triggers</a></li>
<li class="active">Create Trigger</li>
</ol>
<h2>Create Trigger</h2>
<hr>
<form class="form-horizontal" method="post" action="/triggers/create">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="list" value="{{list.id}}">
<div class="form-group">
<label for="trigger-name" class="col-sm-2 control-label">Trigger name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-lg" name="name" id="trigger-name" value="{{name}}" placeholder="Name for this trigger, eg. &quot;Inactive subscribers&quot;" required autofocus>
</div>
</div>
<div class="form-group">
<label for="trigger-description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" id="trigger-description" name="description" rows="3" placeholder="Optional comments about this trigger">{{description}}</textarea>
<span class="help-block">HTML is allowed</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">List</label>
<div class="col-sm-10">
<p class="form-control-static"><a href="/lists/view/{{list.id}}">{{list.name}}</a> <span class="text-muted"> {{list.subscribers}} subscribers</span></p>
</div>
</div>
<fieldset>
<legend>
Trigger rule
</legend>
<div class="form-group">
<label for="trigger-days" class="col-sm-2 control-label">Trigger fires</label>
<div class="col-sm-1">
<input type="number" class="form-control" name="days" id="trigger-days" value="{{days}}" placeholder="1" required>
</div>
<div class="col-sm-1">
<p class="form-control-static">days after:</p>
</div>
</div>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="rule" value="subscription" {{#if isSubscription}} checked {{/if}}> Subscription
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="column" class="col-sm-2 control-label">Event</label>
<div class="col-sm-10">
<select name="column" class="form-control">
<option value="">
Select
</option>
{{#each columns}}
<option value="{{column}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="rule" value="campaign" {{#if isCampaign}} checked {{/if}}> Campaign
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="source-campaign" class="col-sm-2 control-label">Campaign</label>
<div class="col-sm-10">
<select name="source-campaign" class="form-control">
<option value="">
Select
</option>
{{#each sourceCampaigns}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
<div class="form-group">
<label for="campaign-option" class="col-sm-2 control-label">Event</label>
<div class="col-sm-10">
<select name="campaign-option" id="campaign-option" class="form-control">
<option value="">
Select
</option>
{{#each campaignOptions}}
<option value="{{option}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>
Trigger action
</legend>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="action" value="send" {{#if isSend}} checked {{/if}}> Send campaign
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="dest-campaign" class="col-sm-2 control-label">Campaign</label>
<div class="col-sm-10">
<select name="dest-campaign" class="form-control" required>
<option value="">
Select
</option>
{{#each destCampaigns}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
</fieldset>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> Create Trigger</button>
</div>
</div>
</form>

177
views/triggers/edit.hbs Normal file
View file

@ -0,0 +1,177 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li><a href="/triggers/">Automation Triggers</a></li>
<li class="active">Edit Trigger</li>
</ol>
<h2>Edit Trigger <a class="btn btn-default btn-xs" href="/triggers/" role="button"><span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> Back to triggers</a></h2>
<hr>
<form method="post" class="delete-form" id="triggers-delete" action="/triggers/delete">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="id" value="{{id}}" />
</form>
<form class="form-horizontal" method="post" action="/triggers/edit">
<input type="hidden" name="_csrf" value="{{csrfToken}}">
<input type="hidden" name="id" value="{{id}}" />
<div class="form-group">
<label for="trigger-name" class="col-sm-2 control-label">Trigger name</label>
<div class="col-sm-10">
<input type="text" class="form-control input-lg" name="name" id="trigger-name" value="{{name}}" placeholder="Name for this trigger, eg. &quot;Inactive subscribers&quot;" required autofocus>
</div>
</div>
<div class="form-group">
<label for="trigger-description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control" id="trigger-description" name="description" rows="3" placeholder="Optional comments about this trigger">{{description}}</textarea>
<span class="help-block">HTML is allowed</span>
</div>
</div>
<div class="col-sm-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" name="enabled" value="1" {{#if enabled}} checked {{/if}}> Trigger is enabled
</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">List</label>
<div class="col-sm-10">
<p class="form-control-static"><a href="/lists/view/{{list.id}}">{{list.name}}</a> <span class="text-muted"> {{list.subscribers}} subscribers</span></p>
</div>
</div>
<fieldset>
<legend>
Trigger rule
</legend>
<div class="form-group">
<label for="trigger-days" class="col-sm-2 control-label">Trigger fires</label>
<div class="col-sm-1">
<input type="number" class="form-control" name="days" id="trigger-days" value="{{days}}" placeholder="1" required>
</div>
<div class="col-sm-1">
<p class="form-control-static">days after:</p>
</div>
</div>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="rule" value="subscription" {{#if isSubscription}} checked {{/if}}> Subscription
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="column" class="col-sm-2 control-label">Event</label>
<div class="col-sm-10">
<select name="column" class="form-control">
<option value="">
Select
</option>
{{#each columns}}
<option value="{{column}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="rule" value="campaign" {{#if isCampaign}} checked {{/if}}> Campaign
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="source-campaign" class="col-sm-2 control-label">Campaign</label>
<div class="col-sm-10">
<select name="source-campaign" class="form-control">
<option value="">
Select
</option>
{{#each sourceCampaigns}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
<div class="form-group">
<label for="campaign-option" class="col-sm-2 control-label">Event</label>
<div class="col-sm-10">
<select name="campaign-option" id="campaign-option" class="form-control">
<option value="">
Select
</option>
{{#each campaignOptions}}
<option value="{{option}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>
Trigger action
</legend>
<div class="col-sm-offset-2 panel panel-default">
<div class="panel-heading">
<div class="radio">
<label>
<input type="radio" name="action" value="send" {{#if isSend}} checked {{/if}}> Send campaign
</label>
</div>
</div>
<div class="panel-body">
<div class="form-group">
<label for="dest-campaign" class="col-sm-2 control-label">Campaign</label>
<div class="col-sm-10">
<select name="dest-campaign" class="form-control" required>
<option value="">
Select
</option>
{{#each destCampaigns}}
<option value="{{id}}" {{#if selected}} selected {{/if}}>{{name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
</fieldset>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="pull-right">
<button type="submit" form="triggers-delete" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i> Delete Trigger</button>
</div>
<button type="submit" class="btn btn-primary"><i class="glyphicon glyphicon-ok"></i> Update</button>
</div>
</div>
</form>

View file

@ -0,0 +1,83 @@
<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li class="active">Automation Triggers</li>
</ol>
<div class="pull-right">
<a class="btn btn-primary" href="/triggers/create-select" role="button"><i class="glyphicon glyphicon-plus"></i> Create Trigger</a>
</div>
<h2>Automation Triggers</h2>
<hr>
<div class="table-responsive">
<table class="table table-bordered table-hover data-table display nowrap" width="100%" data-row-sort="0,1,1,0,1,0,1,0">
<thead>
<th class="col-md-1">
#
</th>
<th>
Name
</th>
<th>
Status
</th>
<th>
Description
</th>
<th>
List
</th>
<th>
Trigger
</th>
<th>
Target Campaign
</th>
<th class="col-md-1">
&nbsp;
</th>
</thead>
{{#if rows}}
<tbody>
{{#each rows}}
<tr>
<th scope="row">
{{index}}
</th>
<td>
<span class="glyphicon glyphicon-console" aria-hidden="true"></span> {{name}}
</td>
<td>
{{#if enabled}}
<span class="label label-success">Enabled</span>
{{else}}
<span class="label label-default">Disabled</span>
{{/if}}
</td>
<td class="text-muted">
{{description}}
</td>
<td class="text-info">
<a href="/lists/view/{{list}}">{{listName}}</a>
</td>
<td class="text-info">
{{{formatted}}}
</td>
<td class="text-info">
<a href="/campaigns/view/{{destCampaign}}">{{destCampaignName}}</a>
</td>
<td>
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
<a href="/triggers/edit/{{id}}">
Edit
</a>
</td>
</tr>
{{/each}}
</tbody>
{{/if}}
</table>
</div>