Skip to content

Commit

Permalink
fix(web): Fixed preview function for public website templates in the …
Browse files Browse the repository at this point in the history
…admin UI
  • Loading branch information
andris9 committed Jan 18, 2025
1 parent 35e263b commit 6f3567b
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 72 deletions.
2 changes: 1 addition & 1 deletion lib/routes-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ return true;`
{
pageBrandName: request.payload.pageBrandName,
embeddedTemplateHeader: request.payload.templateHeader,
embeddedTemplateHtmlHeadr: request.payload.templateHtmlHead
embeddedTemplateHtmlHead: request.payload.templateHtmlHead
},
{
layout: 'public'
Expand Down
69 changes: 33 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@postalsys/gettext": "4.0.1",
"@postalsys/joi-messages": "1.0.2",
"@postalsys/templates": "2.0.0",
"ace-builds": "1.37.4",
"ace-builds": "1.37.5",
"base32.js": "0.1.0",
"bullmq": "5.34.10",
"compare-versions": "6.1.1",
Expand All @@ -74,7 +74,7 @@
"html-to-text": "9.0.5",
"ical.js": "1.5.0",
"iconv-lite": "0.6.3",
"imapflow": "1.0.176",
"imapflow": "1.0.177",
"ioredfour": "1.3.0-ioredis-07",
"ioredis": "5.4.2",
"ipaddr.js": "2.2.0",
Expand Down Expand Up @@ -104,7 +104,7 @@
"speakeasy": "2.0.0",
"startbootstrap-sb-admin-2": "3.3.7",
"timezones-list": "3.0.3",
"undici": "7.2.1",
"undici": "7.2.3",
"wild-config": "1.7.1",
"xml2js": "0.6.2"
},
Expand Down
2 changes: 1 addition & 1 deletion sbom.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/js/ace/ace.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions static/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/@asamuzakjp/css-color">@asamuzakjp/css-color</a></td>
<td>2.8.2</td>
<td>2.8.3</td>
<td>MIT</td>
<td>asamuzaK</td>
<td></td>
Expand Down Expand Up @@ -1086,7 +1086,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/ace-builds">ace-builds</a></td>
<td>1.37.4</td>
<td>1.37.5</td>
<td>BSD-3-Clause</td>
<td></td>
<td></td>
Expand Down Expand Up @@ -3405,7 +3405,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/imapflow">imapflow</a></td>
<td>1.0.176</td>
<td>1.0.177</td>
<td>MIT</td>
<td>Postal Systems O&#xDC;</td>
<td></td>
Expand Down Expand Up @@ -4085,7 +4085,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/lru-cache">lru-cache</a></td>
<td>11.0.2</td>
<td>10.4.3</td>
<td>ISC</td>
<td>Isaac Z. Schlueter</td>
<td>[email protected]</td>
Expand Down Expand Up @@ -6095,7 +6095,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/tldts-core">tldts-core</a></td>
<td>6.1.71</td>
<td>6.1.72</td>
<td>MIT</td>
<td>R&#xE9;mi Berson</td>
<td></td>
Expand All @@ -6105,7 +6105,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/tldts">tldts</a></td>
<td>6.1.71</td>
<td>6.1.72</td>
<td>MIT</td>
<td>R&#xE9;mi Berson</td>
<td></td>
Expand Down Expand Up @@ -6295,7 +6295,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/undici">undici</a></td>
<td>6.21.0</td>
<td>6.21.1</td>
<td>MIT</td>
<td></td>
<td></td>
Expand All @@ -6305,7 +6305,7 @@ <h1>EmailEngine v2.50.0</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/undici">undici</a></td>
<td>7.2.1</td>
<td>7.2.3</td>
<td>MIT</td>
<td></td>
<td></td>
Expand Down
26 changes: 13 additions & 13 deletions translations/messages.pot
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=ascii\n"
"POT-Creation-Date: 2025-01-15 11:33+0000\n"
"POT-Creation-Date: 2025-01-17 08:49+0000\n"

#: views/config/license.hbs:49
msgid "%d day"
msgid_plural "%d days"
msgstr[0] ""
msgstr[1] ""

#: views/redirect.hbs:1
msgid "Click <a href=\"%s\">here</a> to continue&mldr;"
msgstr ""

#: views/accounts/register/index.hbs:2
msgid "Choose your email account provider"
msgstr ""

#: views/accounts/register/index.hbs:15
msgid "Standard IMAP"
msgstr ""

#: views/unsubscribe.hbs:1
#: views/unsubscribe.hbs:79
msgid "Unsubscribe"
Expand Down Expand Up @@ -76,18 +88,6 @@ msgstr ""
msgid "Continue"
msgstr ""

#: views/redirect.hbs:1
msgid "Click <a href=\"%s\">here</a> to continue&mldr;"
msgstr ""

#: views/accounts/register/index.hbs:2
msgid "Choose your email account provider"
msgstr ""

#: views/accounts/register/index.hbs:15
msgid "Standard IMAP"
msgstr ""

#: views/accounts/register/imap-server.hbs:19
msgid "IMAP"
msgstr ""
Expand Down
27 changes: 18 additions & 9 deletions views/config/service.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@

<div id="templates_settings" class="card mb-4">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Templates</h6>
<h6 class="m-0 font-weight-bold text-primary">Public website templates</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Expand Down Expand Up @@ -553,6 +553,8 @@
<form id="preview-form" method="post" action="/admin/config/service/preview">
<input type="hidden" name="crumb" value="{{crumb}}" />
<input type="hidden" name="templateHeader" id="preview-header-elm">
<input type="hidden" name="templateHtmlHead" id="preview-head-elm">
<input type="hidden" name="pageBrandName" id="preview-brand-name-elm">
</form>


Expand Down Expand Up @@ -618,14 +620,7 @@
});
document.getElementById('preview-header-btn').addEventListener('click', e => {
e.preventDefault();
let previewWindow = window.open('about:blank', 'preview-window', '');
let previewForm = document.getElementById('preview-form');
previewForm.target = 'preview-window';
document.getElementById('preview-header-elm').value = editorHtml.getValue();
previewForm.submit();
});
const editors = new Map();
Expand Down Expand Up @@ -666,6 +661,20 @@
editorHtmlHead.session.setMode("ace/mode/handlebars");
editorHtmlHead.session.setValue(document.getElementById('templateHtmlHeadElement').value);
document.getElementById('preview-header-btn').addEventListener('click', e => {
e.preventDefault();
let previewWindow = window.open('about:blank', 'preview-window', '');
let previewForm = document.getElementById('preview-form');
previewForm.target = 'preview-window';
document.getElementById('preview-brand-name-elm').value = document.getElementById('settingsPageBrandName').value;
document.getElementById('preview-header-elm').value = editorHtml.getValue();
document.getElementById('preview-head-elm').value = editorHtmlHead.getValue();
previewForm.submit();
});
document.getElementById('settings-form').addEventListener('submit', () => {
document.getElementById('templateHeaderElement').value = editorHtml.getValue();
document.getElementById('scriptEnvElement').value = editorEnv.getValue();
Expand Down

0 comments on commit 6f3567b

Please sign in to comment.