Skip to content

Commit

Permalink
TASK: Refactor app rendering to increase resilience
Browse files Browse the repository at this point in the history
Some projects override the body part of Neos.Neos:Page
and change the rendering. This would lead to
several errors in the yoast app.

Resolves: #42
  • Loading branch information
Sebobo committed Jun 5, 2019
1 parent 9290388 commit 8b9fd53
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 47 deletions.
3 changes: 3 additions & 0 deletions Resources/Private/Fusion/Components/Modal.fusion
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
prototype(Yoast.YoastSeoForNeos:Component.Modal) < prototype(Neos.Neos:ContentComponent) {
renderer = '<div id="yoast-modal"></div>'
}
71 changes: 25 additions & 46 deletions Resources/Private/Fusion/Documents/YoastSeoView.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,37 @@ prototype(Yoast.YoastSeoForNeos:Documents.YoastSeoView) < prototype(Neos.Neos:Pa
head {
stylesheets >
stylesheets = Neos.Fusion:Array {
main = Neos.Fusion:Tag {
tagName = 'link'
attributes {
rel = 'stylesheet'
type = 'text/css'
href = Neos.Fusion:ResourceUri {
path = 'resource:https://Yoast.YoastSeoForNeos/Public/Assets/main.css'
}
}
}
main = afx`
<link rel="stylesheet" type="text/css">
<Neos.Fusion:ResourceUri @path="attributes.href" path="resource:https://Yoast.YoastSeoForNeos/Public/Assets/main.css"/>
</link>
`
}
}

bodyTag.attributes.class = 'neos-yoast-seo-view-mode'

body {
templatePath = 'resource:https://Yoast.YoastSeoForNeos/Private/Templates/YoastSeoView.html'
body >
body = Neos.Fusion:Component {
@position = 'after bodyTag'
node = ${node}
site = ${site}

previewWrapper = Neos.Fusion:Tag {
tagName = 'main'
attributes.class = 'yoast-seo__container'

content = Neos.Fusion:Array {
header = Yoast.YoastSeoForNeos:Component.Header
application = Yoast.YoastSeoForNeos:Component.Application
modal = Neos.Fusion:Component {
renderer = afx`
<div id="yoast-modal"></div>
`
}
snippetEditor = Yoast.YoastSeoForNeos:Component.SnippetEditor
}
}

javascripts {
yoastseo = Neos.Fusion:Tag {
tagName = 'script'
attributes {
src = Neos.Fusion:ResourceUri {
path = 'resource:https://Yoast.YoastSeoForNeos/Public/Assets/yoastseo.js'
}
}
}
app = Neos.Fusion:Tag {
tagName = 'script'
attributes {
async = 'async'
src = Neos.Fusion:ResourceUri {
path = 'resource:https://Yoast.YoastSeoForNeos/Public/Assets/app.js'
}
}
}
renderer = Neos.Fusion:Array {
appWrapper = afx`
<main class="yoast-seo__container" @key="appWrapper">
<Yoast.YoastSeoForNeos:Component.Header/>
<Yoast.YoastSeoForNeos:Component.Application/>
<Yoast.YoastSeoForNeos:Component.Modal/>
<Yoast.YoastSeoForNeos:Component.SnippetEditor/>
</main>
<script @key="yoastBundle">
<Neos.Fusion:ResourceUri @path="attributes.src" path="resource:https://Yoast.YoastSeoForNeos/Public/Assets/yoastseo.js"/>
</script>
<script async="async" @key="appBundle">
<Neos.Fusion:ResourceUri @path="attributes.src" path="resource:https://Yoast.YoastSeoForNeos/Public/Assets/app.js"/>
</script>
`
}
}
}
1 change: 0 additions & 1 deletion Resources/Private/Templates/YoastSeoView.html

This file was deleted.

0 comments on commit 8b9fd53

Please sign in to comment.