Changed Twig templates

Changed twig template to reflect changes in precedent commit
This commit is contained in:
Florian Bouillon 2019-04-25 16:15:17 +02:00
parent cacdc2c3d6
commit 64a836c0e4
5 changed files with 37 additions and 50 deletions

View File

@ -1,14 +1,20 @@
{# Default label if type is not found #}
{% spaceless %} {% spaceless %}
{% block form %} {% if name is null %}
{% if label %} {% set name = "input" %}
<label for="{{ name }}">{{label}}</label>
{% endif %} {% endif %}
<input
type="{{ type }}" {% block before %}{% endblock %}
name="{{ name }}" {% if options.label %}
id="{{ name }}" <label for="{{atributes.id }}">{{ options.label }}</label>
{% for index, item in attr %}{{index}}="{{item}}" {% endfor %} {% endif %}
<{{ name }}
{% for index, item in attributes %}{{index}}="{{item}}" {% endfor %}
{% if name == "input" %}
/> />
{% endblock %} {% else %}
>
{% block content %}{% endblock %}
</{{ name }}>
{% endif %}
{% block after %}{% endblock %}
{% endspaceless %} {% endspaceless %}

View File

@ -1,17 +1,13 @@
{% extends "@AdminPanel/form/_default.twig" %} {% extends "@AdminPanel/form/_default.twig" %}
{% block form %} {% set name = "select" %}
{% if label %}
<label for="{{ name }}">{{ label }}</label>
{% endif %}
<select name="{{ name }}" id="{{ name }}"&nbsp;{% for index, item in attr %}{{index}}="{{item}}"&nbsp;{% endfor %}>
{% for choice in choices %}
{% if loop.index0 == value %}
<option value="{{ loop.index0 }}" selected>{{ choice }}</option>
{% else %}
<option value="{{ loop.index0 }}">{{ choice }}</option>
{% endif %}
{% block content %}
{% for choice in options.choices %}
{% if choice == options.value %}
<option selected>{{ choice }}</option>
{% else %}
<option>{{ choice }}</option>
{% endif %}
{% endfor %} {% endfor %}
</select>
{% endblock %} {% endblock %}

View File

@ -1,10 +1 @@
{% extends "@AdminPanel/form/_default.twig" %} {% extends "@AdminPanel/form/_default.twig" %}
{% block form %}
<input
type="date"
name="{{name}}"
id="{{name}}"
{% if value is not null %}value="{{value|date("Y-m-d")}}"{% endif %}
{% for index, item in attr %}{{index}}="{{item}}" {% endfor %}
/>
{% endblock %}

View File

@ -1,13 +1,15 @@
{% extends "@AdminPanel/form/_default.twig" %} {% extends "@AdminPanel/form/_default.twig" %}
{% block form %}
{% if label %}
<label for="{{name}}">{{label}}</label>
{% endif %}
<input type="text" name="{{name}}" id="{{name}}" list="{{name}}_list" {% for index, item in attr %}{{index}}="{{item}}" {% endfor %}/> {% block after %}
<datalist id="{{name}}_list"> <datalist id="{{ attributes.list }}">
{% for entity in entities %} {% for entity in options.entities %}
{% if entity.name is not null %}
<option>{{entity.name}}</option> <option>{{entity.name}}</option>
{% elseif entity.firstname is not null %}
<option>{{entity.firstname}}</option>
{% else %}
<option>{{entity.id}}</option>
{% endif %}
{% endfor %} {% endfor %}
</datalist> </datalist>
{% endblock %} {% endblock %}

View File

@ -1,9 +1 @@
{% extends "@AdminPanel/form/_default.twig" %} {% extends "@AdminPanel/form/_default.twig" %}
{% block form %}
{% if label %}
<label for="{{name}}" />{{label}}</label>
{% endif %}
<input {% if value is not null %}value="{{value}}"{% endif %} type="text" name="{{name}}" id="{{name}}"&nbsp;{% for index, item in attr %}{{index}}="{{item}}"&nbsp;{% endfor %}/>
{% endblock %}