Skip to content

Commit

Permalink
New: Add preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Sep 28, 2022
1 parent 563425d commit 1136ef2
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Configuration/Settings.Neos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ Neos:
translation:
autoInclude:
Garagist.Mjml:
- 'Main'
- 'NodeTypes/*'
editPreviewModes:
mjml:
isEditingMode: false
isPreviewMode: true
fusionRenderingPath: 'mjml'
title: 'Garagist.Mjml:Main:editPreviewMode'
width: 1024
backgroundColor: '#222'
Fusion:
defaultContext:
'Mjml': 'Garagist\Mjml\Eel\MjmlHelper'
Expand Down
15 changes: 15 additions & 0 deletions Resources/Private/Fusion/Root.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,18 @@ root {
}
@cache.entryIdentifier.mjml = ${request.arguments.mjml ? 'mjml' : 'default'}
}

mjml = Neos.Fusion:Case {
canRender {
condition = Neos.Fusion:CanRender {
type = ${node.nodeType.name + '.Mjml'}
}
type = ${node.nodeType.name + '.Mjml'}
}
notSet {
condition = true
renderer = Carbon.Notification:Document {
content = ${Translation.translate('editPreviewMode.noSet', 'No HTML newsletter output is configured for this page type', [], 'Main', 'Garagist.Mjml')}
}
}
}
16 changes: 16 additions & 0 deletions Resources/Private/Translations/de/Main.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2"
xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Garagist.Mjml" source-language="en" target-language="de" datatype="plaintext">
<body>
<trans-unit id="editPreviewMode" xml:space="preserve">
<source>HTML Newsletter</source>
<target>HTML Newsletter</target>
</trans-unit>
<trans-unit id="editPreviewMode.noSet" xml:space="preserve">
<source>No HTML newsletter output is configured for this page type</source>
<target>Für diesen Seitentyp ist keine HTML Newsletter Ausgabe konfiguriert</target>
</trans-unit>
</body>
</file>
</xliff>
14 changes: 14 additions & 0 deletions Resources/Private/Translations/en/Main.xlf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2"
xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Garagist.Mjml" source-language="en" datatype="plaintext">
<body>
<trans-unit id="editPreviewMode" xml:space="preserve">
<source>HTML Newsletter</source>
</trans-unit>
<trans-unit id="editPreviewMode.noSet" xml:space="preserve">
<source>No HTML newsletter output is configured for this page type</source>
</trans-unit>
</body>
</file>
</xliff>
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"php": "^8.0",
"neos/neos": "^7.3 || ^8.0",
"garagist/plaintext": "^0.1",
"carbon/eel": "^2.0"
"carbon/eel": "^2.0",
"carbon/notification": "^2.4"
},
"suggest": {
"garagist/mautic": "To use the Mautic integration"
Expand Down

0 comments on commit 1136ef2

Please sign in to comment.