-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.html.twig
More file actions
54 lines (49 loc) · 2.4 KB
/
list.html.twig
File metadata and controls
54 lines (49 loc) · 2.4 KB
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
{% extends 'base.html.twig' %}
{% block title %}{{ parent() }} {{ 'list'|trans({}, 'article') }}{% endblock %}
{% block body %}
{% if is_granted('ROLE_ADMIN') %}
<a href="{{ path('app_article_new') }}">{{ 'add'|trans({}, 'actions') }}</a>
<br/><br/>
{% endif %}
{% if articles|length > 0 %}
<div>{{ 'num_of_articles'|trans({ count: articles|length }, 'article') }}</div>
<br/>
{{ include('article/_paginate.html.twig') }}
<br/><br/>
<table class="table">
<thead>
<tr>
<th>{{ 'name'|trans({}, 'article') }}</th>
<th>{{ 'description'|trans({}, 'article') }}</th>
<th>{{ 'price_HT'|trans({}, 'article') }}</th>
<th>{{ 'price_TTC'|trans({}, 'article') }}</th>
<th>{{ 'image'|trans({}, 'article') }}</th>
<th>{{ 'view'|trans({}, 'actions') }}</th>
{% if is_granted('ROLE_ADMIN') %}
<th>{{ 'edit'|trans({}, 'actions') }}</th>
<th>{{ 'delete'|trans({}, 'actions') }}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for article in articles %}
<tr>
<td>{{ article.name }}</td>
<td>{{ article.description|u.truncate(30, '...')|nl2br }}</td>
<td>{{ article.priceHT|format_currency('EUR') }}</td>
<td>{{ article.priceTTC|format_currency('EUR') }}</td>
<td><img src="{{ asset(article.fullPathImage) }}"></td>
<td><a href="{{ path('app_article_show', {'id': article.id}) }}"><img width="48" height="48" src="https://img.icons8.com/color/48/search--v1.png" alt="view"/></a></td>
{% if is_granted('ROLE_ADMIN') %}
<td><a href="{{ path('app_article_edit', {'id': article.id}) }}"><img width="48" height="48" src="https://img.icons8.com/color-glass/48/pencil.png" alt="form"/></a></td>
<td>{{ include('article/_delete_form.html.twig') }}</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{{ include('article/_paginate.html.twig') }}
{% else %}
<div>{{ 'no_article'|trans({}, 'article') }}</div>
{% endif %}
{% endblock %}