This repository has been archived by the owner on Jan 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 283
/
index.html.twig.twig
89 lines (59 loc) · 3.02 KB
/
index.html.twig.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{% block extends %}
{{ "{% extends 'base.html.twig' %}" }}
{% endblock extends %}
{% block body %}
{{ "{% block body %}" }}
<h1>{{ entity_pluralized|capitalize }} list</h1>
<table>
<thead>
<tr>
{%- for field, metadata in fields %}
<th>{{ field|capitalize }}</th>
{%- endfor %}
<th>Actions</th>
</tr>
</thead>
<tbody>
{{ '{% for ' ~ entity_singularized ~ ' in ' ~ entity_pluralized ~ ' %}' }}
<tr>
{%- for field, metadata in fields %}
{%- if loop.first and ('show' in actions) %}
<td><a href="{{ "{{ path('" ~ route_name_prefix ~ "_show', { '"~ identifier ~"': " ~ entity_singularized ~ "."~ identifier ~" }) }}" }}">{{ '{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' }}' }}</a></td>
{%- elseif metadata.type in ['datetime'] %}
<td>{{ '{% if ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' %}{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ '|date(\'Y-m-d H:i:s\') }}{% endif %}' }}</td>
{%- elseif metadata.type in ['date'] %}
<td>{{ '{% if ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' %}{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ '|date(\'Y-m-d\') }}{% endif %}' }}</td>
{%- elseif metadata.type in ['time'] %}
<td>{{ '{% if ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' %}{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ '|date(\'H:i:s\') }}{% endif %}' }}</td>
{%- elseif metadata.type in ['array'] %}
<td>{{ '{% if ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' %}{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ '|join(\', \') }}{% endif %}' }}</td>
{%- elseif metadata.type in ['boolean'] %}
<td>{{ '{% if ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' %}Yes{% else %}No{% endif %}' }}</td>
{%- else %}
<td>{{ '{{ ' ~ entity_singularized ~ '.' ~ field|replace({'_': ''}) ~ ' }}' }}</td>
{%- endif %}
{%- if loop.last %}
<td>
<ul>
{%- for action in record_actions %}
<li>
<a href="{{ "{{ path('" ~ route_name_prefix ~ "_" ~ action ~ "', { '"~ identifier ~"': " ~ entity_singularized ~ "."~ identifier ~" }) }}" }}">{{ action }}</a>
</li>
{%- endfor %}
</ul>
</td>
{%- endif %}
{%- endfor %}
</tr>
{{ '{% endfor %}' }}
</tbody>
</table>
{% if 'new' in actions -%}
<ul>
<li>
<a href="{{ "{{ path('" ~ route_name_prefix ~ "_new') }}" }}">Create a new {{ entity_singularized }}</a>
</li>
</ul>
{%- endif %}
{{ "{% endblock %}" }}
{% endblock body %}