Merge branch 'master' of github.com:andris9/mailtrain
This commit is contained in:
commit
37531f2550
9 changed files with 52 additions and 60 deletions
|
@ -188,7 +188,7 @@ function formatMessage(serviceUrl, campaign, list, subscription, message, filter
|
|||
return message.replace(/\[([a-z0-9_]+)(?:\/([^\]]+))?\]/ig, (match, identifier, fallback) => {
|
||||
identifier = identifier.toUpperCase();
|
||||
let value = (getValue(identifier) || fallback || '').trim();
|
||||
return value ? filter(value) : '';
|
||||
return value ? filter(value) : match;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -64,20 +64,26 @@ router.get('/:campaign/:list/:subscription', passport.csrfProtection, (req, res,
|
|||
}
|
||||
|
||||
let renderHtml = (html, renderTags) => {
|
||||
campaign.editorName = campaign.editorName || 'summernote';
|
||||
let sfx = '';
|
||||
if (campaign.editorName !== 'summernote' && campaign.editorName !== 'codeeditor') {
|
||||
sfx = '-raw';
|
||||
let render = (view, layout) => {
|
||||
res.render(view, {
|
||||
layout,
|
||||
message: renderTags ? tools.formatMessage(serviceUrl, campaign, list, subscription, html) : html,
|
||||
campaign,
|
||||
list,
|
||||
subscription,
|
||||
attachments,
|
||||
csrfToken: req.csrfToken()
|
||||
});
|
||||
};
|
||||
|
||||
if (campaign.editorName && campaign.editorName !== 'summernote' && campaign.editorName !== 'codeeditor') {
|
||||
res.render('partials/tracking-scripts', { layout: 'archive/layout-raw' }, (err, scripts) => {
|
||||
html = scripts ? html.replace(/<\/body\b/i, match => scripts + match) : html;
|
||||
render('archive/view-raw', 'archive/layout-raw');
|
||||
});
|
||||
} else {
|
||||
render('archive/view', 'archive/layout');
|
||||
}
|
||||
res.render('archive/view' + sfx, {
|
||||
layout: 'archive/layout' + sfx,
|
||||
message: renderTags ? tools.formatMessage(serviceUrl, campaign, list, subscription, html) : html,
|
||||
campaign,
|
||||
list,
|
||||
subscription,
|
||||
attachments,
|
||||
csrfToken: req.csrfToken()
|
||||
});
|
||||
};
|
||||
|
||||
let renderAndShow = (html, renderTags) => {
|
||||
|
|
|
@ -41,24 +41,8 @@
|
|||
<script src="/bootstrap/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
{{#if uaCode}}
|
||||
<script>
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function() {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date();
|
||||
a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||
{{> tracking_scripts}}
|
||||
|
||||
ga('create', '{{uaCode}}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
{{/if}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
</div>
|
||||
|
||||
{{#if disableWysiwyg}}
|
||||
{{> codeeditor}}
|
||||
{{> codeeditor}}
|
||||
{{else}}
|
||||
{{> summernote}}
|
||||
{{> summernote}}
|
||||
{{/if}}
|
||||
|
||||
<div class="form-group" style="margin-top: -15px;">
|
||||
|
|
|
@ -131,12 +131,12 @@
|
|||
|
||||
{{> merge_tag_reference}}
|
||||
|
||||
{{> plaintext}}
|
||||
{{> plaintext}}
|
||||
|
||||
{{#if disableWysiwyg}}
|
||||
{{> codeeditor}}
|
||||
{{> codeeditor}}
|
||||
{{else}}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
|
|
|
@ -147,12 +147,12 @@
|
|||
|
||||
{{> merge_tag_reference}}
|
||||
|
||||
{{> plaintext}}
|
||||
{{> plaintext}}
|
||||
|
||||
{{#if disableWysiwyg}}
|
||||
{{> codeeditor}}
|
||||
{{> codeeditor}}
|
||||
{{else}}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
|
|
|
@ -153,24 +153,8 @@
|
|||
<script src="/javascript/editor.js"></script>
|
||||
{{/if}}
|
||||
|
||||
{{#if uaCode}}
|
||||
<script>
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function() {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date();
|
||||
a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||
{{> tracking_scripts}}
|
||||
|
||||
ga('create', '{{uaCode}}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
{{/if}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
18
views/partials/tracking-scripts.hbs
Normal file
18
views/partials/tracking-scripts.hbs
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{#if uaCode}}
|
||||
<script>
|
||||
(function(i, s, o, g, r, a, m) {
|
||||
i['GoogleAnalyticsObject'] = r;
|
||||
i[r] = i[r] || function() {
|
||||
(i[r].q = i[r].q || []).push(arguments)
|
||||
}, i[r].l = 1 * new Date();
|
||||
a = s.createElement(o),
|
||||
m = s.getElementsByTagName(o)[0];
|
||||
a.async = 1;
|
||||
a.src = g;
|
||||
m.parentNode.insertBefore(a, m)
|
||||
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
|
||||
|
||||
ga('create', '{{uaCode}}', 'auto');
|
||||
ga('send', 'pageview');
|
||||
</script>
|
||||
{{/if}}
|
|
@ -26,12 +26,12 @@
|
|||
|
||||
{{> merge_tag_reference mergeTagReferenceFooterText='In addition to that any custom field can have its own merge tag.'}}
|
||||
|
||||
{{> plaintext}}
|
||||
{{> plaintext}}
|
||||
|
||||
{{#if disableWysiwyg}}
|
||||
{{> codeeditor}}
|
||||
{{> codeeditor}}
|
||||
{{else}}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{> (lookup . 'editorName') }}
|
||||
{{/if}}
|
||||
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue