Skip to content

Commit 166cb5b

Browse files
authored
Merge pull request #23 from robertlemke/dev
TASK: Adjust to Neos 4.0
2 parents 2ba2b61 + adf65bc commit 166cb5b

File tree

7 files changed

+101
-113
lines changed

7 files changed

+101
-113
lines changed

Configuration/Routes.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@
3636
'@subpackage': ''
3737
'@controller': ''
3838
'@action': 'index'
39-
'currentPage': '1'
39+
'@format': 'html'
4040
routeParts:
4141
node:
4242
handler: 'Neos\Neos\Routing\FrontendNodeRoutePartHandler'
43-
appendExceedingArguments: true
4443

4544
-
4645
name: 'Blog post pagination - page > 1'
@@ -55,10 +54,10 @@
5554
'@subpackage': ''
5655
'@controller': ''
5756
'@action': 'index'
57+
'@format': 'html'
5858
routeParts:
5959
node:
6060
handler: 'Neos\Neos\Routing\FrontendNodeRoutePartHandler'
61-
appendExceedingArguments: true
6261

6362
-
6463
name: 'RSS Feed special super extra workaround route (for until we can use different formats in plugins)'

Configuration/Settings.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Neos:
2121
Flow:
2222
mvc:
2323
routes:
24-
'RobertLemke.Plugin.Blog': true
24+
'RobertLemke.Plugin.Blog':
25+
position: 'before Neos.Neos'
2526

2627
Neos:
2728
nodeTypes:

Resources/Private/Fusion/Root.fusion

Lines changed: 55 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
#
2-
# Add the paginator's "current page" value to cache entry identifiers in cache layers above the blog posts index.
3-
# Depending on your actual page structure you will have to add this identifier part to further TypoScript object
4-
# cache configurations.
2+
# Add the paginator's "current page" value to cache entry identifiers.
53
#
6-
[email protected] = ${request.pluginArguments.posts-paginator.currentPage}
7-
8-
prototype(Neos.Neos:Page) {
9-
@cache.entryIdentifier.blogPostsPaginatorCurrentPage = ${request.pluginArguments.posts-paginator.currentPage}
10-
}
11-
12-
prototype(Neos.Neos:PrimaryContent).default {
13-
[email protected] = ${request.pluginArguments.posts-paginator.currentPage}
14-
}
15-
16-
#
17-
# Add a new matcher to the rendering of the main content (PrimaryContent) to check if the current node
18-
# is a blog post document. In this case we don't render a ContentCollection like the default matcher
19-
# but render the blog post TypoScript object.
20-
#
21-
prototype(Neos.Neos:PrimaryContent).blogPost {
22-
condition = ${q(documentNode).is('[instanceof RobertLemke.Plugin.Blog:Post]')}
23-
type = 'RobertLemke.Plugin.Blog:Post'
24-
}
4+
prototype(Neos.Fusion:GlobalCacheIdentifiers).blogPostsPaginatorCurrentPage = ${request.pluginArguments.posts-paginator.currentPage}
255

266
#
277
# Blog Post is rendered by a Template-based TypoScript object which contains some
@@ -36,80 +16,81 @@ prototype(Neos.Neos:PrimaryContent).blogPost {
3616
# The blog post comments are just several Text nodes which are as well rendered
3717
# through the TypoScript collection feature.
3818
#
39-
prototype(RobertLemke.Plugin.Blog:Post) < prototype(Neos.Neos:Content) {
40-
node = ${node}
19+
prototype(RobertLemke.Plugin.Blog:Post) < prototype(Neos.NodeTypes:Page) {
20+
body.content.main = RobertLemke.Plugin.Blog:PostRenderer
21+
}
4122

42-
# Render the main ContentCollection of the Post like a page would
43-
main = Neos.Neos:ContentCollection {
44-
nodePath = 'main'
45-
}
23+
prototype(RobertLemke.Plugin.Blog:PostRenderer) < prototype(Neos.Fusion:Template) {
24+
templatePath = 'resource://RobertLemke.Plugin.Blog/Private/Templates/NodeTypes/Post.html'
25+
node = ${node}
26+
title = ${q(node).property('title')}
27+
author = ${q(node).property('author')}
28+
datePublished = ${q(node).property('datePublished')}
4629

47-
# Render an additional ContentCollection for comments
48-
comments = Neos.Neos:ContentCollection {
49-
nodePath = 'comments'
50-
}
30+
# Render the main ContentCollection of the Post like a page would
31+
main = Neos.Neos:ContentCollection {
32+
nodePath = 'main'
33+
}
5134

52-
numberOfComments = ${q(node).children('comments').children('[spam = false]').count()}
35+
# Render an additional ContentCollection for comments
36+
comments = Neos.Neos:ContentCollection {
37+
nodePath = 'comments'
38+
}
5339

54-
@cache {
55-
mode = 'cached'
56-
entryIdentifier {
57-
node = ${node}
58-
content = 'blogpost'
59-
}
60-
entryTags {
61-
1 = ${'Node_' + node.identifier}
62-
2 = ${'DescendantOf_' + q(node).find('main').property('_identifier')}
63-
3 = ${'DescendantOf_' + q(node).find('comments').property('_identifier')}
64-
}
65-
}
66-
}
40+
numberOfComments = ${q(node).children('comments').children('[spam = false]').count()}
6741

68-
#
69-
# Blog Comment is rendered by a vanilla Template-based TypoScript object
70-
#
71-
prototype(RobertLemke.Plugin.Blog:Comment) {
42+
@cache {
43+
mode = 'cached'
44+
entryIdentifier {
45+
node = ${node}
46+
content = 'blogpost'
47+
}
48+
entryTags {
49+
1 = ${'Node_' + node.identifier}
50+
2 = ${'DescendantOf_' + q(node).find('main').property('_identifier')}
51+
3 = ${'DescendantOf_' + q(node).find('comments').property('_identifier')}
52+
}
53+
}
7254
}
7355

7456
#
7557
# List of most recent blog posts, including pagination
7658
#
7759
prototype(RobertLemke.Plugin.Blog:PostsOverview) < prototype(Neos.Neos:Content) {
78-
hasPostNodes = true
79-
postsNode = ${q(node).closest('[instanceof Neos.Neos:Document]').get(0)}
80-
currentPage = ${request.pluginArguments.posts-paginator.currentPage}
60+
postsNode = ${q(node).closest('[instanceof Neos.Neos:Document]').get(0)}
61+
currentPage = ${request.pluginArguments.posts-paginator.currentPage}
8162

82-
@cache {
83-
mode = 'cached'
84-
entryIdentifier {
85-
documentNode = ${node}
86-
currentPage = ${request.pluginArguments.posts-paginator.currentPage}
87-
}
88-
entryTags {
89-
1 = ${'Node_' + node.identifier}
90-
2 = ${'DescendantOf_' + q(node).property('_identifier')}
91-
}
92-
}
63+
@cache {
64+
mode = 'cached'
65+
entryIdentifier {
66+
documentNode = ${node}
67+
currentPage = ${request.pluginArguments.posts-paginator.currentPage}
68+
}
69+
entryTags {
70+
1 = ${'Node_' + node.identifier}
71+
2 = ${'DescendantOf_' + q(node).property('_identifier')}
72+
}
73+
}
9374
}
9475

9576
#
9677
# RSS feed
9778
#
9879
prototype(RobertLemke.Plugin.Blog:Feed) < prototype(Neos.Neos:Plugin) {
99-
package = 'RobertLemke.Plugin.Blog'
100-
controller = 'Post'
101-
action = 'rss'
80+
package = 'RobertLemke.Plugin.Blog'
81+
controller = 'Post'
82+
action = 'rss'
10283

103-
postsNode = ${q(documentNode).parent().get(0)}
84+
postsNode = ${q(documentNode).parent().get(0)}
10485

105-
feedTitle = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.title')}
106-
feedDescription = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.description')}
107-
feedUri = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.uri')}
108-
includeContent = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.includeContent')}
86+
feedTitle = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.title')}
87+
feedDescription = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.description')}
88+
feedUri = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.uri')}
89+
includeContent = ${Configuration.setting('RobertLemke.Plugin.Blog.feed.includeContent')}
10990
}
11091

11192
#
11293
# Quote is a straight-forward content type
11394
#
114-
prototype(RobertLemke.Plugin.Blog:Quote) < prototype(Neos.Neos:Content) {
115-
}
95+
prototype(RobertLemke.Plugin.Blog:Quote) < prototype(Neos.Neos:Content)
96+

Resources/Private/Templates/NodeTypes/Partials/FormErrors.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<f:form.validationResults for="{for}">
1+
<f:validation.results for="{for}">
22
<f:if condition="{validationResults.flattenedErrors}">
33
<dl class="errors">
44
<f:for each="{validationResults.flattenedErrors}" key="propertyPath" as="errors">
@@ -11,4 +11,4 @@
1111
</f:for>
1212
</dl>
1313
</f:if>
14-
</f:form.validationResults>
14+
</f:validation.results>

Resources/Private/Templates/NodeTypes/Post.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
<h1 itemprop="name headline"><neos:contentElement.editable tag="span" property="title">{title}</neos:contentElement.editable></h1>
2626
<div class="byline">
2727
by
28-
<span itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">{node.properties.author}</span></span>
28+
<span itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span itemprop="name">{author}</span></span>
2929
on
30-
<time datetime="{f:format.date(date: node.properties.datePublished, format: 'c')}" itemprop="datePublished"><f:format.date format="F jS, Y">{node.properties.datePublished}</f:format.date></time>
30+
<time datetime="{f:format.date(date: datePublished, format: 'c')}" itemprop="datePublished"><f:format.date format="F jS, Y">{datePublished}</f:format.date></time>
3131
</div><br />
3232
</header>
3333
<div itemprop="articleBody">
34-
<fusion:render path="main" />
34+
{main -> f:format.raw()}
3535
</div>
3636
<hr />
3737
<div id="comments" class="comments">
@@ -54,4 +54,4 @@ <h3><f:translate package="RobertLemke.Plugin.Blog">Leave a reply</f:translate></
5454
<button class="secondary button">{f:translate(value: 'Submit', package: 'Neos.Flow')}</button>
5555
</f:form>
5656
</div>
57-
</article>
57+
</article>

Resources/Private/Templates/NodeTypes/PostsOverview.html

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,23 @@
2323
});
2424
</script>
2525
<div class="robertlemke-plugin-blog" id="scrolling-container">
26-
<f:if condition="{hasPostNodes}">
27-
<f:then>
28-
<cr:widget.paginate widgetId="posts-paginator" parentNode="{postsNode}" nodeTypeFilter="RobertLemke.Plugin.Blog:Post" as="paginatedPosts" configuration="{itemsPerPage: 5, insertBelow: 1, maximumNumberOfLinks: 15}">
29-
<ol class="posts">
30-
<f:for each="{paginatedPosts}" as="post">
31-
<li class="post">
32-
<h2>
33-
<neos:link.node node="{post}">{post.properties.title}</neos:link.node>
34-
<f:if condition="{post.removed}"> (removed)</f:if>
35-
</h2>
36-
<p class="content">
37-
<neos:link.node node="{post}" class="invisible-link">
38-
<blog:teaser node="{post}"/>
39-
</neos:link.node> <neos:link.node node="{post}" class="read-more"><f:translate package="RobertLemke.Plugin.Blog">Read more</f:translate></neos:link.node>
40-
</p>
41-
</li>
42-
<hr/>
43-
</f:for>
44-
</ol>
45-
{pagination.numberOfPages}
46-
</cr:widget.paginate>
47-
</f:then>
48-
<f:else>
49-
<p><f:translate package="RobertLemke.Plugin.Blog">This blog currently doesn't contain any posts.</f:translate></p>
50-
</f:else>
51-
</f:if>
52-
</div>
26+
<cr:widget.paginate widgetId="posts-paginator" parentNode="{postsNode}" nodeTypeFilter="RobertLemke.Plugin.Blog:Post" as="paginatedPosts" configuration="{itemsPerPage: 5, insertBelow: 1, maximumNumberOfLinks: 15}">
27+
<ol class="posts">
28+
<f:for each="{paginatedPosts}" as="post">
29+
<li class="post">
30+
<h2>
31+
<neos:link.node node="{post}">{post.properties.title}</neos:link.node>
32+
<f:if condition="{post.removed}"> (removed)</f:if>
33+
</h2>
34+
<p class="content">
35+
<neos:link.node node="{post}" class="invisible-link">
36+
<blog:teaser node="{post}"/>
37+
</neos:link.node> <neos:link.node node="{post}" class="read-more"><f:translate package="RobertLemke.Plugin.Blog">Read more</f:translate></neos:link.node>
38+
</p>
39+
</li>
40+
<hr/>
41+
</f:for>
42+
</ol>
43+
{pagination.numberOfPages}
44+
</cr:widget.paginate>
45+
</div>

composer.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
],
1414
"require": {
15-
"neos/neos": "~3.0",
15+
"neos/neos": "~4.0",
1616
"robertlemke/akismet": "~2.0",
1717
"robertlemke/rss": "~2.0",
1818
"flownative/gravatar": "~2.0"
@@ -93,7 +93,21 @@
9393
"Neos.Neos-20161219094403",
9494
"Neos.Neos-20161219122512",
9595
"Neos.Fusion-20161219130100",
96-
"Neos.Neos-20161220163741"
96+
"Neos.Neos-20161220163741",
97+
"TYPO3.Form-20160601101500",
98+
"Neos.Form-20161124205254",
99+
"Neos.Kickstart-20161124230102",
100+
"Neos.SiteKickstarter-20161125002311",
101+
"Neos.SiteKickstarter-20161125095901",
102+
"Neos.Kickstarter-20161125110814",
103+
"Neos.Neos-20170115114620",
104+
"Neos.Fusion-20170120013047",
105+
"Neos.Flow-20170125103800",
106+
"Neos.Seo-20170127154600",
107+
"Neos.Flow-20170127183102",
108+
"Neos.Fusion-20180211175500",
109+
"Neos.Fusion-20180211184832",
110+
"Neos.Flow-20180415105700"
97111
]
98112
}
99113
}

0 commit comments

Comments
 (0)