Skip to content

Commit

Permalink
Merge pull request #32 from sbruggmann/neos-4-0
Browse files Browse the repository at this point in the history
TASK: Make the comments package Neos 4.0 ready
  • Loading branch information
sbruggmann authored Nov 6, 2018
2 parents 8887d2c + 4befd12 commit 65be01d
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 50 deletions.
18 changes: 9 additions & 9 deletions Documentation/Examples/ExtendTheCommentForm.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,37 @@ _Vendor.Blog/Configuration/NodeTypes.Comment.yaml_
_Vendor.Blog/Classes/Vendor/Blog/Domain/Model/Comment.php_

<?php

namespace Vendor\Blog\Domain\Model;

use Neos\Flow\Annotations as Flow;
use WebExcess\Comments\Domain\Model\Comment as CommentOriginal;
use WebExcess\Comments\Domain\Model\CommentInterface;

class Comment extends CommentOriginal implements CommentInterface
{

/**
* @var string
*/
protected $phone;

/**
* @return string
*/
public function getPhone()
{
return $this->phone;
}

/**
* @param string $phone
*/
public function setPhone($phone)
{
$this->phone = $phone;
}

}

**Replace the original Comment-Model with your version**
Expand Down Expand Up @@ -101,14 +101,14 @@ _Vendor.Blog/Resources/Private/Templates/Comments/Index.html_

_Vendor.Blog/Resources/Private/Partials/Comments/TextField.html_

<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="mf-input{f:if(condition: validationResults.flattenedErrors, then: ' mf-has-error')}">
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" class="mf-input-field" />
<div class="mf-input-bar"></div>
<label for="{fieldname}" class="mf-input-label"><f:translate id="properties.phone.{fieldname}" package="Vendor.Blog" source="NodeTypes/Comment" value="{f:translate(id: 'comment.form.{fieldname}', package: 'WebExcess.Comments')}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>

**Add your field translation**

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This package provides your visitors the possibility to comment stuff and discuss
| Neos | Package | Maintained |
|------|---------|------------|
| 3.x | 0.0.x | YES |
| 4.x | 0.1.x | YES |

## Installation
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-check{f:if(condition: validationResults.flattenedErrors, then: ' has-danger')}">
<label class="form-check-label">
<f:form.checkbox property="{fieldname}" id="{fieldname}" class="form-check-input" value="1" /> <comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}
</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Bootstrap/Error.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="form-group has-danger">
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:if>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-group{f:if(condition: validationResults.flattenedErrors, then: ' has-danger')}">
<label for="{fieldname}" class="form-control-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:form.textarea property="{fieldname}" id="{fieldname}" rows="3" class="form-control" errorClass="form-control-danger" />
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-group{f:if(condition: validationResults.flattenedErrors, then: ' has-danger')}">
<label for="{fieldname}" class="form-control-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" class="form-control" errorClass="form-control-danger" />
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Float/Checkbox.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-checkbox{f:if(condition: validationResults.flattenedErrors, then: ' has-error')}">
<label class="form-checkbox-legend">
<f:form.checkbox property="{fieldname}" id="{fieldname}" class="form-check-input" value="1" />
Expand All @@ -8,4 +8,4 @@
</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Float/Error.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="form-input has-error">
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:if>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Float/TextArea.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-textarea{f:if(condition: validationResults.flattenedErrors, then: ' has-error')}">
<f:form.textarea property="{fieldname}" id="{fieldname}" rows="3" class="form-textarea-field" />
<label for="{fieldname}" class="form-textarea-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Float/TextField.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-input{f:if(condition: validationResults.flattenedErrors, then: ' has-error')}">
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" class="form-input-field" />
<label for="{fieldname}" class="form-input-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-group{f:if(condition: validationResults.flattenedErrors, then: ' is-invalid-label')}">
<f:form.checkbox property="{fieldname}" id="{fieldname}" value="1" />
<label for="{fieldname}"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Foundation/Error.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="form-group is-invalid-label">
<label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</label>
</div>
</f:if>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-group{f:if(condition: validationResults.flattenedErrors, then: ' is-invalid-label')}">
<label>
<comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}
<f:form.textarea property="{fieldname}" id="{fieldname}" rows="3" class="form-control" />
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</label>
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="form-group{f:if(condition: validationResults.flattenedErrors, then: ' is-invalid-label')}">
<label>
<comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" class="form-control" />
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</label>
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="mf-checkbox{f:if(condition: validationResults.flattenedErrors, then: ' mf-has-error')}">
<label>
<f:form.checkbox property="{fieldname}" id="{fieldname}" class="form-check-input" value="1" />
Expand All @@ -8,4 +8,4 @@
</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/Material/Error.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="mf-input mf-has-error">
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:if>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="mf-textarea{f:if(condition: validationResults.flattenedErrors, then: ' mf-has-error')}">
<f:form.textarea property="{fieldname}" id="{fieldname}" rows="3" class="mf-textarea-field" />
<div class="mf-textarea-bar"></div>
<label for="{fieldname}" class="mf-textarea-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="mf-input{f:if(condition: validationResults.flattenedErrors, then: ' mf-has-error')}">
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" class="mf-input-field" />
<div class="mf-input-bar"></div>
<label for="{fieldname}" class="mf-input-label"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="clearfix{f:if(condition: validationResults.flattenedErrors, then: ' error')}">
<label>
<f:form.checkbox property="{fieldname}" id="{fieldname}" value="1" />
<span><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</span>
</label>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
4 changes: 2 additions & 2 deletions Resources/Private/Partials/FormElements/WebExcess/Error.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<f:if condition="{validationResults.flattenedErrors}">
<div class="clearfix error">
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:if>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="clearfix{f:if(condition: validationResults.flattenedErrors, then: ' error')}">
<label for="{fieldname}"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<div class="input">
<f:form.textarea property="{fieldname}" id="{fieldname}" rows="3" />
</div>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{namespace comments=WebExcess\Comments\ViewHelpers}
<f:form.validationResults for="comment.{fieldname}">
<f:validation.results for="comment.{fieldname}">
<div class="clearfix{f:if(condition: validationResults.flattenedErrors, then: ' error')}">
<label for="{fieldname}"><comments:translate id="comment.form.{fieldname}" />{f:if(condition: required, then: '<sup class="is-required">*</sup>')}</label>
<div class="input">
<f:form.textfield property="{fieldname}" id="{fieldname}" type="{f:if(condition: type, then: type, else: 'text')}" />
</div>
<f:render partial="Validation" arguments="{fieldname: fieldname}" />
</div>
</f:form.validationResults>
</f:validation.results>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"require": {
"neos/neos": "*",
"flowpack/listable": "~2.0.1",
"flowpack/listable": "~3.0",
"neos/swiftmailer": "~6.0.0"
},
"suggest": {
Expand Down

0 comments on commit 65be01d

Please sign in to comment.