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 %}
{% block form %}
{% if label %}
<label for="{{ name }}">{{label}}</label>
{% endif %}
<input
type="{{ type }}"
name="{{ name }}"
id="{{ name }}"
{% for index, item in attr %}{{index}}="{{item}}" {% endfor %}
/>
{% endblock %}
{% if name is null %}
{% set name = "input" %}
{% endif %}
{% block before %}{% endblock %}
{% if options.label %}
<label for="{{atributes.id }}">{{ options.label }}</label>
{% endif %}
<{{ name }}
{% for index, item in attributes %}{{index}}="{{item}}" {% endfor %}
{% if name == "input" %}
/>
{% else %}
>
{% block content %}{% endblock %}
</{{ name }}>
{% endif %}
{% block after %}{% endblock %}
{% endspaceless %}

View File

@ -1,17 +1,13 @@
{% extends "@AdminPanel/form/_default.twig" %}
{% block form %}
{% 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 %}
{% set name = "select" %}
{% block content %}
{% for choice in options.choices %}
{% if choice == options.value %}
<option selected>{{ choice }}</option>
{% else %}
<option>{{ choice }}</option>
{% endif %}
{% endfor %}
</select>
{% endblock %}

View File

@ -1,10 +1 @@
{% 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" %}
{% 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 %}/>
<datalist id="{{name}}_list">
{% for entity in entities %}
<option>{{entity.name}}</option>
{% block after %}
<datalist id="{{ attributes.list }}">
{% for entity in options.entities %}
{% if entity.name is not null %}
<option>{{entity.name}}</option>
{% elseif entity.firstname is not null %}
<option>{{entity.firstname}}</option>
{% else %}
<option>{{entity.id}}</option>
{% endif %}
{% endfor %}
</datalist>
</datalist>
{% endblock %}

View File

@ -1,9 +1 @@
{% 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 %}