update fields rendering for gumby

This commit is contained in:
Julien Fastré 2013-11-07 22:37:08 +01:00
parent abdae3e7f2
commit 2b915a83d0

View File

@ -5,12 +5,67 @@
<div class="field inline"> <div class="field inline">
{{ form_errors(form) }} {{ form_errors(form) }}
{{ form_label(form) }} {{ form_label(form) }}
{{ form_widget(form, {'attr' : {'class': 'input wide'} }) }} {{ form_widget(form) }}
</div> </div>
{% endspaceless %} {% endspaceless %}
{% endblock form_row %} {% endblock form_row %}
{% block form_widget_simple %}
{% spaceless %}
{% if attr.class is not defined %}
{% set attr = {'class' : 'input wide'} %}
{% endif %}
{% set type = type|default('text') %}
<input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{% endspaceless %}
{% endblock form_widget_simple %}
{% block textarea_widget %}
{% spaceless %}
{% if attr.class is not defined %}
{% set attr = {'class' : 'input textarea'} %}
{% endif %}
<textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
{% endspaceless %}
{% endblock textarea_widget %}
{% block choice_widget_collapsed %}
<div class="picker">
{% spaceless %}
{% if required and empty_value is none and not empty_value_in_choices %}
{% set required = false %}
{% endif %}
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
{% if empty_value is not none %}
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ empty_value|trans({}, translation_domain) }}</option>
{% endif %}
{% if preferred_choices|length > 0 %}
{% set options = preferred_choices %}
{{ block('choice_widget_options') }}
{% if choices|length > 0 and separator is not none %}
<option disabled="disabled">{{ separator }}</option>
{% endif %}
{% endif %}
{% set options = choices %}
{{ block('choice_widget_options') }}
</select>
{% endspaceless %}
</div>
{% endblock choice_widget_collapsed %}
{% block choice_widget_expanded %}
{% spaceless %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline radio'} }) }}
{% endfor %}
</div>
{% endspaceless %}
{% endblock choice_widget_expanded %}
{% block date_widget %} {% block date_widget %}
{% spaceless %} {% spaceless %}
{% if widget == 'single_text' %} {% if widget == 'single_text' %}
@ -18,9 +73,9 @@
{% else %} {% else %}
<div {{ block('widget_container_attributes') }}> <div {{ block('widget_container_attributes') }}>
{{ date_pattern|replace({ {{ date_pattern|replace({
'{{ year }}': form_widget(form.year, {'attr': {'class': 'input'} } ), '{{ year }}': form_widget(form.year ),
'{{ month }}': form_widget(form.month, {'attr': {'class': 'input'} } ), '{{ month }}': form_widget(form.month ),
'{{ day }}': form_widget(form.day, {'attr': {'class': 'input'} } ), '{{ day }}': form_widget(form.day ),
})|raw }} })|raw }}
</div> </div>
{% endif %} {% endif %}