Skip to content

Commit

Permalink
Merge pull request #27 from AndreEtienne/DAVSHOP-891-improve-enhanced…
Browse files Browse the repository at this point in the history
…-checkbox

DAVSHOP-891 improve enhanced checkbox
  • Loading branch information
baschny authored Apr 8, 2019
2 parents 6c88b90 + 7010a95 commit eaf9dac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 34 deletions.
18 changes: 4 additions & 14 deletions Configuration/NodeTypes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@
reloadIfChanged: true
inspector:
group: options

value:
defaultValue: 'Checked'

'CRON.FormBuilder:CheckBoxEnhanced':
superTypes:
Expand All @@ -265,9 +266,9 @@
ui:
label: CRON.FormBuilder:NodeTypes.Plugin:fields.checkbox.enhanced
properties:
text:
type: string
label:
ui:
inspector: []
label: Text
inlineEditable: true
aloha:
Expand All @@ -276,17 +277,6 @@
'p': true
link:
'a': true
mainText:
type: string
ui:
label: CRON.FormBuilder:NodeTypes.Plugin:fields.checkbox.enhanced.mainText
reloadIfChanged: true
inspector:
group: options
editor: 'Neos.Neos/Inspector/Editors/TextAreaEditor'
editorOptions:
rows: 10


'CRON.FormBuilder:TextArea':
superTypes:
Expand Down
3 changes: 1 addition & 2 deletions Resources/Private/Fusion/Root.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ prototype(CRON.FormBuilder:CheckBoxEnhanced) < prototype(CRON.FormBuilder:FormEl
layoutName = 'CheckboxWrapper'
attributes.class = ''
checked = ${this.value || q(node).property('checked')}
text = ${q(node).property('text')}
mainText = ${q(node).property('mainText')}
label = ${q(node).property('label')}
}

prototype(CRON.FormBuilder:CheckBoxGroup) < prototype(CRON.FormBuilder:FormElement) {
Expand Down
10 changes: 7 additions & 3 deletions Resources/Private/Templates/Email/Form.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
{field.node.properties.label}
=============================
<f:for each="{field.values}" as="subField">
{subField.node.properties.label}: {subField.value}
<f:if condition="{subField.node.properties.label} != ''">
{subField.node.properties.label -> f:format.stripTags()}: {subField.value}
</f:if>
</f:for>
</f:then>
<f:else>
{field.node.properties.label}: {field.value}
<f:if condition="{field.node.properties.label} != ''">
{field.node.properties.label -> f:format.stripTags()}: {field.value}
</f:if>
</f:else>
</f:if>
</f:for>
</f:section>
</f:section>
21 changes: 6 additions & 15 deletions Resources/Private/Templates/NodeTypes/CheckBoxEnhanced.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
{namespace neos=Neos\Neos\ViewHelpers}
<f:layout name="{layoutName}" />
<f:section name="Content">
<div class="checkbox-enhanced {f:if(condition: validationResults.flattenedErrors, then: 'has-error')}">
<div class=" checkbox-enhanced {f:if(condition: validationResults.flattenedErrors, then: 'has-error')}">
<f:if condition="{neos:rendering.inBackend()}">
<f:then>
<f:if condition="{mainText}">
<div>
{mainText -> f:format.raw()}
</div>
</f:if>
<label>
<input {attributes -> f:format.raw()} type="checkbox" onclick="return false;"/> {neos:contentElement.editable(property: 'text', tag: 'p')}
</label>
<div class="checkbox-enhanced-label">
<input style="margin-right: 10px;" {attributes -> f:format.raw()} type="checkbox" onclick="return false;"/>
{neos:contentElement.editable(property: 'label', tag: 'p')}
</div>
</f:then>
<f:else>
<f:if condition="{mainText}">
<div>
{mainText -> f:format.raw()}
</div>
</f:if>
<div class="checkbox-enhanced-label">
<input {attributes -> f:format.raw()} type="hidden" value="">
<input {attributes -> f:format.raw()} type="checkbox" value="{node.properties.value}" {f:if(condition: checked, then: 'checked')}/>
<label>
{text -> f:format.raw()}
{label -> f:format.raw()}
</label>
</div>
</f:else>
Expand Down

0 comments on commit eaf9dac

Please sign in to comment.