chill-bundles/Resources/views/Form/fields.html.twig
Julien Fastré fe1a9a0838 add form to formatter
The formatter can add a form. This form is handle by controller and exportManager.

[WIP] The csv formatter ask the user to ordering the aggregators.
2016-04-15 23:13:41 +02:00

144 lines
5.3 KiB
Twig

{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% block form_row %}
{% spaceless %}
<div class="{% spaceless %}
{% if attr.class is defined and ('cf-title' in attr.class or 'cf-fields' in attr.class ) %}
grid-12
{% elseif attr.class is defined and 'multiple-cf-inline' in attr.class %}
grid-2 grid-mobile-4 grid-tablet-4 mobile-clear tablet-clear
{% else %}
grid-4 clear
{% endif %}
{% endspaceless %}">
{% if attr.class is not defined or ('cf-title' not in attr.class and 'cf-fields' not in attr.class ) %}
{{ form_label(form) }}
{% endif %}
</div>
<div class="{% spaceless %}
{% if attr.class is defined and 'cf-title' in attr.class %}
grid-12
{% elseif attr.class is defined and 'cf-fields' in attr.class %}
grid-12 parent
{% elseif attr.class is defined and 'multiple-cf-inline' in attr.class %}
grid-2 grid-mobile-8 grid-tablet-8 multiple-cf-inline
{% else %}
grid-8
{% endif %}
{% endspaceless %}">
{{ form_widget(form) }}
{{ form_errors(form) }}
</div>
{% endspaceless %}
{% endblock form_row %}
{% block choice_widget_expanded %}
{% spaceless %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
<span class="inline-choice">
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
</span>
{% endfor %}
</div>
<script type="text/javascript">chill.checkNullValuesInChoices("{{ form.vars.full_name }}");</script>
{% endspaceless %}
{% endblock choice_widget_expanded %}
{% block choice_with_other_widget %}
{% spaceless %}
{% for child in form._choices %}
{%- if child.vars.value != '_other' -%}
<div class="inline-choice">
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
</div>
{%- else -%}
<div class="container">
<div class="grid-6 grid-tablet-12 gid-mobile-12 no-gutter">
<span class="inline-choice">
{{ form_widget(child) }}
{{ form_label(child, '', {'label_attr': { 'class' : 'inline'} }) }}
</span>
</div>
<div class="grid-6 grid-tablet-12 gid-mobile-12 no-gutter">
{{ form_widget(form._other, {'attr': {'class': 'input-text-other-value'} }) }}
</div>
</div>
{%- endif -%}
{% endfor %}
<script type="text/javascript">
chill.checkNullValuesInChoices("{{ form._choices.vars.full_name }}");
</script>
{% endspaceless %}
{% endblock choice_with_other_widget %}
{% block date_widget %}
{% spaceless %}
{% if widget == 'single_text' %}
{% set attr = {'class' : 'input datepicker'} %}
{{ block('form_widget_simple') }}
{% else %}
<div {{ block('widget_container_attributes') }}>
{{ date_pattern|replace({
'{{ year }}': form_widget(form.year ),
'{{ month }}': form_widget(form.month ),
'{{ day }}': form_widget(form.day ),
})|raw }}
</div>
{% endif %}
{% endspaceless %}
{% endblock date_widget %}
{%- block time_widget -%}
{%- if widget == 'single_text' -%}
{{ block('form_widget_simple') }}
{%- else -%}
{%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%}
{% set attr = {'class' : 'time_compound ' ~ attr.class|default('') } %}
<div {{ block('widget_container_attributes') }}>
{{ form_widget(form.hour, vars) }}{% if with_minutes %}<span class="separator">:</span>{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}<span class="separator">:</span>{{ form_widget(form.second, vars) }}{% endif %}
</div>
{%- endif -%}
{%- endblock time_widget -%}
{% block form_errors %}
{% spaceless %}
{% if errors|length > 0 %}
<ul class="errors">
{% for error in errors %}
<li>{{ error.message }}</li>
{% endfor %}
</ul>
{% endif %}
{% endspaceless %}
{% endblock form_errors %}
{% block _formatter__aggregator_placement_csv_formatter_row %}
<h3>{{ form_label(form) }}</h3>
{{ form_row(form.order) }}
{{ form_row(form.position) }}
{% endblock %}