Commit baaaaab4 authored by Daniel Kestler's avatar Daniel Kestler

Add cookie consent settings, translations and loading code for frontend rendering

parent f578248a
...@@ -7,3 +7,16 @@ Medienreaktor: ...@@ -7,3 +7,16 @@ Medienreaktor:
CookieConsent: CookieConsent:
includeJavaScript: true includeJavaScript: true
includeStyles: true includeStyles: true
translationsPackage: 'Medienreaktor.CookieConsent'
settings:
type: null
position: 'bottom'
theme: 'block'
palette:
popup:
background: '#333'
text: '#fff'
button:
background: '#fff'
text: '#333'
informationNode: null
prototype(Neos.Neos:Page) { prototype(Neos.Neos:Page) {
head { head {
cookieConsent = Medienreaktor.CookieConsent cookieConsent = Medienreaktor.CookieConsent {
cookieConsent {
@position = 'end' @position = 'end'
} }
} }
...@@ -13,12 +12,13 @@ prototype(Medienreaktor.CookieConsent) < prototype(Neos.Fusion:Array) { ...@@ -13,12 +12,13 @@ prototype(Medienreaktor.CookieConsent) < prototype(Neos.Fusion:Array) {
attributes { attributes {
rel = 'stylesheet' rel = 'stylesheet'
type = 'text/css' type = 'text/css'
src = Neos.Fusion:ResourceUri { href = Neos.Fusion:ResourceUri {
path = 'resource://Medienreaktor.CookieConsent/Public/Styles/cookieconsent.min.css' path = 'resource://Medienreaktor.CookieConsent/Public/Styles/cookieconsent.min.css'
} }
} }
@if.includeStyles = ${Configuration.setting('Medienreaktor.CookieConsent.includeStyles')} @if.includeStyles = ${Configuration.setting('Medienreaktor.CookieConsent.includeStyles')}
} }
javaScript = Neos.Fusion:Tag { javaScript = Neos.Fusion:Tag {
tagName = 'script' tagName = 'script'
attributes { attributes {
...@@ -29,4 +29,34 @@ prototype(Medienreaktor.CookieConsent) < prototype(Neos.Fusion:Array) { ...@@ -29,4 +29,34 @@ prototype(Medienreaktor.CookieConsent) < prototype(Neos.Fusion:Array) {
} }
@if.includeJavaScript = ${Configuration.setting('Medienreaktor.CookieConsent.includeJavaScript')} @if.includeJavaScript = ${Configuration.setting('Medienreaktor.CookieConsent.includeJavaScript')}
} }
loadingScript = Neos.Fusion:Value {
@context {
settings = Neos.Fusion:RawArray {
type = ${Configuration.setting('Medienreaktor.CookieConsent.settings.type')}
position = ${Configuration.setting('Medienreaktor.CookieConsent.settings.position')}
theme = ${Configuration.setting('Medienreaktor.CookieConsent.settings.theme')}
palette = ${Configuration.setting('Medienreaktor.CookieConsent.settings.palette')}
content = Neos.Fusion:RawArray {
message = ${Translation.translate('message', null, [], 'CookieConsent', Configuration.setting('Medienreaktor.CookieConsent.translationsPackage'))}
link = ${Translation.translate('link', null, [], 'CookieConsent', Configuration.setting('Medienreaktor.CookieConsent.translationsPackage'))}
allow = ${Translation.translate('allow', null, [], 'CookieConsent', Configuration.setting('Medienreaktor.CookieConsent.translationsPackage'))}
deny = ${Translation.translate('deny', null, [], 'CookieConsent', Configuration.setting('Medienreaktor.CookieConsent.translationsPackage'))}
dismiss = ${Translation.translate('dismiss', null, [], 'CookieConsent', Configuration.setting('Medienreaktor.CookieConsent.translationsPackage'))}
href = Neos.Neos:NodeUri {
node = ${q(site).find(Configuration.setting('Medienreaktor.CookieConsent.informationNode')).get(0)}
@if.hasInformationNode = ${Configuration.setting('Medienreaktor.CookieConsent.informationNode') ? true : false }
}
}
@process.json = ${Json.stringify(value)}
}
}
@process.wrap = ${'<script>window.addEventListener("load", function() { window.cookieconsent.initialise(' + settings + ') });</script>'}
}
@if.inFrontend = ${site.context.inBackend == false}
} }
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Medienreaktor.CookieConsent" source-language="de" datatype="plaintext">
<body>
<trans-unit id="message">
<source>Diese Website verwendet Cookies, um optimal gestaltet und fortlaufend verbessert werden zu können. Durch die Nutzung der Webseite stimmen Sie dieser Verwendung von Cookies zu.</source>
</trans-unit>
<trans-unit id="link">
<source>Mehr erfahren</source>
</trans-unit>
<trans-unit id="allow">
<source>Cookies zulassen</source>
</trans-unit>
<trans-unit id="deny">
<source>Cookies ablehnen</source>
</trans-unit>
<trans-unit id="dismiss">
<source>Okay</source>
</trans-unit>
</body>
</file>
</xliff>
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="" product-name="Medienreaktor.CookieConsent" source-language="en" datatype="plaintext">
<body>
<trans-unit id="message">
<source>This website uses cookies to ensure you get the best experience on our website.</source>
</trans-unit>
<trans-unit id="link">
<source>Learn more</source>
</trans-unit>
<trans-unit id="allow">
<source>Allow cookies</source>
</trans-unit>
<trans-unit id="deny">
<source>Decline</source>
</trans-unit>
<trans-unit id="dismiss">
<source>Okay</source>
</trans-unit>
</body>
</file>
</xliff>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment