Skip to content

Commit 3cb8b43

Browse files
committed
Move the package list template to a separate file
1 parent 6e3056d commit 3cb8b43

2 files changed

Lines changed: 46 additions & 45 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div class="d-grid gap-3">
2+
{% for package in packages %}
3+
<div class="card">
4+
<div class="card-body py-2">
5+
{% set packageInfoUrl = dashboard_path('dashboard_packages_info', {packageName: package.name}) %}
6+
<a href="{{ packageInfoUrl }}"><h5 class="card-title">{{ package.name }}</h5></a>
7+
{% if package.mirrorRegistry %}
8+
<p class="card-text mb-1 text-body-secondary">Mirrored from {{ package.mirrorRegistry.name }}</p>
9+
{% endif %}
10+
<p class="card-text">{{ package.description ?? '<em>No description provided.</em>' }}</p>
11+
</div>
12+
</div>
13+
{% else %}
14+
<table class="table datagrid datagrid-empty">
15+
<tbody>
16+
{% for i in 1..14 %}
17+
<tr class="empty-row">
18+
<td><span></span></td>
19+
<td><span></span></td>
20+
<td><span></span></td>
21+
<td><span></span></td>
22+
<td><span></span></td>
23+
<td><span></span></td>
24+
</tr>
25+
26+
{% if 3 == loop.index %}
27+
<tr class="no-results">
28+
<td colspan="100">
29+
{{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
30+
</td>
31+
</tr>
32+
{% endif %}
33+
{% endfor %}
34+
</tbody>
35+
</table>
36+
{% endfor %}
37+
</div>
38+
39+
{% if packages|length %}
40+
<div class="content-panel-footer without-padding without-border">
41+
{% block paginator %}
42+
{{ include(ea.templatePath('crud/paginator')) }}
43+
{% endblock paginator %}
44+
</div>
45+
{% endif %}

templates/dashboard/packages/list.html.twig

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,5 @@
2525
{% endblock %}
2626

2727
{% block page_content %}
28-
<div class="d-grid gap-3">
29-
{% for package in packages %}
30-
<div class="card">
31-
<div class="card-body py-2">
32-
{% set packageInfoUrl = dashboard_path('dashboard_packages_info', {packageName: package.name}) %}
33-
<a href="{{ packageInfoUrl }}"><h5 class="card-title">{{ package.name }}</h5></a>
34-
{% if package.mirrorRegistry %}
35-
<p class="card-text mb-1 text-body-secondary">Mirrored from {{ package.mirrorRegistry.name }}</p>
36-
{% endif %}
37-
<p class="card-text">{{ package.description ?? '<em>No description provided.</em>' }}</p>
38-
</div>
39-
</div>
40-
{% else %}
41-
<table class="table datagrid datagrid-empty">
42-
<tbody>
43-
{% for i in 1..14 %}
44-
<tr class="empty-row">
45-
<td><span></span></td>
46-
<td><span></span></td>
47-
<td><span></span></td>
48-
<td><span></span></td>
49-
<td><span></span></td>
50-
<td><span></span></td>
51-
</tr>
52-
53-
{% if 3 == loop.index %}
54-
<tr class="no-results">
55-
<td colspan="100">
56-
{{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
57-
</td>
58-
</tr>
59-
{% endif %}
60-
{% endfor %}
61-
</tbody>
62-
</table>
63-
{% endfor %}
64-
</div>
65-
66-
{% if packages|length %}
67-
<div class="content-panel-footer without-padding without-border">
68-
{% block paginator %}
69-
{{ include(ea.templatePath('crud/paginator')) }}
70-
{% endblock paginator %}
71-
</div>
72-
{% endif %}
28+
{{ include('dashboard/packages/_package_list.html.twig', {packages: packages, paginator: paginator}, with_context: false) }}
7329
{% endblock %}

0 commit comments

Comments
 (0)