[TASK] EXT:form - Optimize frontend templates 26/51426/2
authorAndreas Steiger <typo3@andreassteiger.de>
Wed, 25 Jan 2017 15:40:03 +0000 (16:40 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 26 Jan 2017 15:48:05 +0000 (16:48 +0100)
* add attribute role="alert" to error hints
* streamline bootstrap 3 error classes
* add attribute formnovalidate to previous button of multistep form
* remove fieldset wrap from element type 'PAGE'

Resolves: #69974
Releases: master
Change-Id: I66336879bed0f94752482404c3ed7cfa7028046d
Reviewed-on: https://review.typo3.org/51426
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Tested-by: Bjoern Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/form/Resources/Private/Frontend/Layouts/FormElements/Field.html
typo3/sysext/form/Resources/Private/Frontend/Partials/FormElements/Form/Navigation.html
typo3/sysext/form/Resources/Private/Frontend/Templates/FormElements/Page.html

index 0002b90..76af7ba 100644 (file)
@@ -1,22 +1,22 @@
 {namespace formvh=TYPO3\CMS\Form\ViewHelpers}
-<div class="form-group">
-    <label for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.required}"><f:render partial="Field/Required" /></f:if></label>
-    <div class="{element.properties.containerClassAttribute}">
-        <f:render section="field" />
-        <f:format.raw>
-            <f:form.validationResults for="{element.identifier}">
+<f:form.validationResults for="{element.identifier}">
+    <div class="form-group{f:if(condition: '{validationResults.errors.0}', then: ' has-error')}">
+        <label class="control-label" for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.required}"><f:render partial="Field/Required" /></f:if></label>
+        <div class="{element.properties.containerClassAttribute}">
+            <f:render section="field" />
+            <f:format.raw>
                 <f:if condition="{validationResults.flattenedErrors}">
-                    <span class="form-control-feedback error help-inline">
+                    <span class="error help-block" role="alert">
                         <f:for each="{validationResults.errors}" as="error">
-                            {error -> f:translate(key: '{element.renderingOptions.translation.translationFile}:validation.error.{error.code}', arguments: error.arguments)}
+                            {error -> f:translate(key: 'LLL:{element.renderingOptions.translation.translationFile}:validation.error.{error.code}', arguments: error.arguments)}
                             <br />
                         </f:for>
                     </span>
                 </f:if>
-            </f:form.validationResults>
-        </f:format.raw>
-        <f:if condition="{element.properties.elementDescription}">
-            <span class="help-block">{formvh:translateElementProperty(element: element, property: 'elementDescription')}</span>
-        </f:if>
+            </f:format.raw>
+            <f:if condition="{element.properties.elementDescription}">
+                <span class="help-block">{formvh:translateElementProperty(element: element, property: 'elementDescription')}</span>
+            </f:if>
+        </div>
     </div>
-</div>
\ No newline at end of file
+</f:form.validationResults>
index 154f80c..46eacd2 100644 (file)
@@ -3,7 +3,7 @@
         <div class="btn-group" role="group">
             <f:if condition="{form.previousPage}">
                 <span class="previous">
-                    <f:form.button property="__currentPage" value="{form.previousPage.index}" class="btn btn-cancel">{formvh:translateElementProperty(element: form.currentPage, renderingOptionProperty: 'previousButtonLabel')}</f:form.button>
+                    <f:form.button property="__currentPage" value="{form.previousPage.index}" class="btn btn-cancel" formnovalidate="formnovalidate">{formvh:translateElementProperty(element: form.currentPage, renderingOptionProperty: 'previousButtonLabel')}</f:form.button>
                 </span>
             </f:if>
             <f:if condition="{form.nextPage}">
index cf7462f..7ad0090 100644 (file)
@@ -1,9 +1,7 @@
 {namespace formvh=TYPO3\CMS\Form\ViewHelpers}
-<fieldset class="form-group">
-    <f:if condition="{page.label}">
-        <legend>{formvh:translateElementProperty(element: page, property: 'label')}</legend>
-    </f:if>
-    <f:for each="{page.elements}" as="element">
-        <formvh:renderRenderable renderable="{element}" />
-    </f:for>
-</fieldset>
\ No newline at end of file
+<f:if condition="{page.label}">
+    <h2>{formvh:translateElementProperty(element: page, property: 'label')}</h2>
+</f:if>
+<f:for each="{page.elements}" as="element">
+    <formvh:renderRenderable renderable="{element}" />
+</f:for>
\ No newline at end of file