Skip to content

Commit e77f7e4

Browse files
author
Marvin Kuhn
committed
added some translations and fixed some namespace issues
1 parent eb8fbe9 commit e77f7e4

File tree

17 files changed

+156
-12
lines changed

17 files changed

+156
-12
lines changed

Classes/Form/Finisher/AddCommentFormFinisher.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ protected function executeInternal()
2222
{
2323
try {
2424
$commentableNode = $this->parseOption('node');
25+
26+
if ($commentableNode === null) {
27+
throw new InvalidNodeTypeException('Node should be of type '.CommentService::COMMENTABLE_NODE_TYPE.' null given.', 1536671893);
28+
}
29+
2530
$this->commentService->addComment($commentableNode, $this->getCommentDto());
2631
} catch (\Exception | InvalidNodeTypeException $exception) {
2732
$this->finisherContext->cancel();

Configuration/NodeTypes.Collection.Comments.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
label: '${ I18n.translate(node.nodeType.label) }'
55
ui:
66
icon: 'icon-comments'
7-
label: 'Comments'
7+
label: 'i18n'
88
constraints:
99
nodeTypes:
1010
'*': false

Configuration/NodeTypes.Mixin.Commentable.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
abstract: true
33
childNodes:
44
comments:
5-
type: 'Breadlesscode.Blog:Collection.Comments'
5+
type: 'Breadlesscode.Commentable:Collection.Comments'
66
position: 'after main'

Configuration/Settings.Form.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Neos:
2+
Form:
3+
presets:
4+
'default':
5+
finisherPresets:
6+
'Breadlesscode.Commentable:From.Finisher.AddComment':
7+
implementationClassName: 'Breadlesscode\Commentable\Form\Finisher\AddCommentFormFinisher'

Configuration/Settings.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Neos:
2+
Neos:
3+
userInterface:
4+
translation:
5+
autoInclude:
6+
'Breadlesscode.Commentable':
7+
- 'NodeTypes/Collection/*'
8+
- 'NodeTypes/Content/*'
9+
- 'NodeTypes/Mixin/*'
10+
fusion:
11+
autoInclude:
12+
Breadlesscode.Commentable: true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
prototype(Breadlesscode.Commentable:Collection.Comment) < prototype(Neos.Neos:ContentCollection) {
2+
nodePath = 'comments'
3+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
prototype(Breadlesscode.Commentable:Component.Comment) < prototype(Neos.Fusion:Component) {
2+
name = ''
3+
email = ''
4+
content = ''
5+
createdAt = ''
6+
7+
renderer = Neos.Fusion:Tag {
8+
content = Neos.Fusion:Array {
9+
name = Neos.Fusion:Tag {
10+
tagName = 'p'
11+
content = ${ props.name }
12+
}
13+
content = Neos.Fusion:Tag {
14+
tagName = 'p'
15+
content = ${ props.content }
16+
}
17+
createdAt = Neos.Fusion:Tag {
18+
tagName = 'p'
19+
content = ${ 'Created at: ' + Date.format(props.createdAt, 'd.m.Y H:i') }
20+
}
21+
}
22+
attributes.class = 'comment'
23+
}
24+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
prototype(Breadlesscode.Commentable:Content.Comment) < prototype(Neos.Neos:ContentComponent) {
2+
renderer = Breadlesscode.Commentable:Component.Comment {
3+
name = ${ q(node).property('name') }
4+
email = ${ q(node).property('email') }
5+
content = ${ q(node).property('content') }
6+
createdAt = ${ q(node).property('createdAt') }
7+
}
8+
}
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
2-
3-
prototype(Neos.NodeTypes:Form) {
4-
presetName = 'fusion'
5-
}
61
prototype(Breadlesscode.Commentable:Form.Comment) < prototype(Neos.Form.Builder:Form) {
72
@context.commentableNode = ${ documentNode }
8-
presetName = 'fusion'
93

104
firstPage {
115
elements {
126
name = Neos.Form.Builder:SingleLineText.Definition {
13-
label = 'Name'
7+
label = ${ Translation.translate('Breadlesscode.Commentable:Form.Comment:name.label') }
148
}
159
email = Neos.Form.Builder:SingleLineText.Definition {
16-
label = 'E-Mail'
10+
label = ${ Translation.translate('Breadlesscode.Commentable:Form.Comment:email.label') }
1711
}
1812
message = Neos.Form.Builder:MultiLineText.Definition {
19-
label = 'Message'
13+
label = ${ Translation.translate('Breadlesscode.Commentable:Form.Comment:content.label') }
2014
}
2115
}
2216
}
17+
2318
finishers {
2419
addComment = Breadlesscode.Commentable:From.Finisher.AddComment.Definition {
2520
options {
@@ -30,4 +25,12 @@ prototype(Breadlesscode.Commentable:Form.Comment) < prototype(Neos.Form.Builder:
3025
}
3126
}
3227
}
28+
29+
@cache {
30+
context {
31+
1 = 'none'
32+
2 = 'documentNode'
33+
3 = 'commentableNode'
34+
}
35+
}
3336
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include: Component/**/*.fusion
2+
include: Collection/**/*.fusion
3+
include: Form/**/*.fusion
4+
include: Content/**/*.fusion
5+
6+
#####
7+
#
8+
# Thanks for using this package :)
9+
#
10+
#####

0 commit comments

Comments
 (0)