Skip to content

Commit a474df7

Browse files
author
Hans Höchtl
authored
Merge pull request #5 from simonschaufi/neos5
Update composer for Neos 5
2 parents 5276809 + c1db855 commit a474df7

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.idea

Classes/Controller/AjaxFormController.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@
1313

1414
class AjaxFormController extends ActionController
1515
{
16-
1716
/**
1817
* @var Context
1918
*/
2019
protected $securityContext;
20+
2121
/**
2222
* @Flow\Inject
2323
* @var \Neos\Flow\I18n\Service
2424
*/
2525
protected $i18nService;
2626

27-
2827
/**
2928
* Injects the Security Context
3029
*
@@ -40,15 +39,18 @@ public function injectSecurityContext(Context $securityContext)
4039
* @param string $formIdentifier
4140
* @param string $presetName
4241
* @param string $locale
42+
* @throws \Neos\Flow\I18n\Exception\InvalidLocaleIdentifierException
4343
*/
4444
public function indexAction($formIdentifier, $presetName, $locale = '')
4545
{
4646
if (!empty($locale)) {
4747
$currentLocale = new Locale($locale);
4848
$this->i18nService->getConfiguration()->setCurrentLocale($currentLocale);
4949
}
50-
$this->view->assign('formIdentifier', $formIdentifier);
51-
$this->view->assign('presetName', $presetName);
52-
}
5350

51+
$this->view->assignMultiple([
52+
'formIdentifier' => $formIdentifier,
53+
'presetName' => $presetName,
54+
]);
55+
}
5456
}

Configuration/Routes.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
-
32
name: 'Ajax Form Endpoint'
43
uriPattern: '__form/{formIdentifier}/{presetName}(/{locale})'

Resources/Public/JavaScript/form.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ var AjaxForm = (function () {
1010
this._form = element.querySelector('form');
1111
if (!this._form) {
1212
throw new Error('No form element found in ajax container');
13-
}
14-
else {
13+
} else {
1514
this.bindFormSubmitListener();
1615
}
1716
}
@@ -33,16 +32,14 @@ var AjaxForm = (function () {
3332
this._form = this._delegator.querySelector('form');
3433
if (this._form) {
3534
this.bindFormSubmitListener();
36-
}
37-
else {
35+
} else {
3836
if (this._request.response.indexOf('data-reset-form') > -1) {
3937
window.setTimeout(function () {
4038
_this.ajax(null, _this.handleResponse.bind(_this));
4139
}, 5000);
4240
}
4341
}
44-
}
45-
else {
42+
} else {
4643
console.error('Something went wrong with the ajax form request');
4744
}
4845
};
@@ -69,7 +66,7 @@ var AjaxForm = (function () {
6966
return AjaxForm;
7067
}());
7168
(function () {
72-
document.addEventListener("DOMContentLoaded", function () {
69+
document.addEventListener('DOMContentLoaded', function () {
7370
var ajaxForms = document.querySelectorAll('[data-ajax="ajax-form"]');
7471
for (var i = 0; i < ajaxForms.length; i++) {
7572
new AjaxForm(ajaxForms.item(i));

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"MIT"
77
],
88
"require": {
9-
"neos/neos": "~3.0 | ^4.0",
10-
"neos/nodetypes-form": "~3.0 | ^4.0"
9+
"neos/neos": "~3.0 || ^4.0 || ^5.0",
10+
"neos/nodetypes-form": "~3.0 || ^4.0 || ^5.0"
1111
},
1212
"autoload": {
1313
"psr-4": {
@@ -94,4 +94,4 @@
9494
"Neos.Neos.Ui-20190319094900"
9595
]
9696
}
97-
}
97+
}

0 commit comments

Comments
 (0)