Skip to content

Commit 13ce2cd

Browse files
Merge pull request #54 from sumocoders/user-overview-cards
Make layout more mobile friendly, add cards for users
2 parents 366ce26 + 9aaeff6 commit 13ce2cd

3 files changed

Lines changed: 47 additions & 50 deletions

File tree

templates/user/admin/add.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{ form_start(form) }}
99

1010
<div class="row">
11-
<div class="col-6">
11+
<div class="col-md-6">
1212
{{ form_row(form.email) }}
1313
{{ form_row(form.roles) }}
1414

templates/user/admin/edit.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{{ form_start(form) }}
3838

3939
<div class="row">
40-
<div class="col-6">
40+
<div class="col-md-6">
4141
{{ form_row(form.email) }}
4242
{{ form_row(form.roles) }}
4343

templates/user/admin/overview.html.twig

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,57 +26,54 @@
2626

2727
<hr>
2828

29-
<table class="table table-striped">
30-
<thead>
31-
<tr>
32-
<th scope="col">{{ 'Username'|trans }}</th>
33-
<th scope="col">{{ 'Roles'|trans }}</th>
34-
<th scope="col">{{ 'Confirmed'|trans }}</th>
35-
<th scope="col">{{ 'Enabled'|trans }}</th>
36-
<th scope="col"></th>
37-
<th scope="col"></th>
38-
</tr>
39-
</thead>
40-
<tbody>
29+
<div class="row g-3 mb-4">
4130
{% for user in users %}
42-
<tr>
43-
<th scope="row">{{ user.username }}</th>
44-
<td>
45-
{% for role in user.getDisplayRoles %}
46-
{% if loop.index0 > 0 %},{% endif %}
47-
{{ role|trans }}
48-
{% endfor %}
49-
</td>
50-
<td>
51-
{% if user.confirmed %}
52-
<i class="text-success fas fa-check"></i>
53-
{% else %}
54-
<i class="text-danger fas fa-times"></i>
55-
{% endif %}
56-
</td>
57-
<td>
58-
{% if user.enabled %}
59-
<i class="text-success fas fa-check"></i>
60-
{% else %}
61-
<i class="text-danger fas fa-times"></i>
62-
{% endif %}
63-
</td>
64-
<td>
65-
<a class="text-nowrap" href="{{ path('user_admin_edit', {user: user.id}) }}">
66-
<i class="fas fa-edit" title="{{ 'Edit user'|trans }}" data-controller="tooltip" data-bs-placement="top"></i>
67-
</a>
68-
</td>
69-
{% if is_granted('ROLE_ADMIN') %}
70-
<td>
71-
<a class="text-nowrap" href="{{ impersonation_path(user.username) }}" data-turbo-prefetch="false">
72-
<i class="fas fa-sign-in-alt" title="{{ 'Switch to user'|trans }}" data-controller="tooltip" data-bs-placement="top"></i>
31+
<div class="col-md-6 col-lg-4">
32+
<div class="card">
33+
<div class="card-body">
34+
<h3 class="card-title mb-3">{{ user.username }}</h3>
35+
<p>
36+
{{ 'Roles'|trans }}:
37+
{% for role in user.getDisplayRoles %}
38+
{{ role|trans }}
39+
{% if not loop.last %},{% endif %}
40+
{% endfor %}
41+
</p>
42+
<div class="d-flex justify-content-between">
43+
<div>{{ 'Confirmed'|trans }}</div>
44+
<div>
45+
{% if user.confirmed %}
46+
<i class="text-success fas fa-check"></i>
47+
{% else %}
48+
<i class="text-danger fas fa-times"></i>
49+
{% endif %}
50+
</div>
51+
</div>
52+
<div class="d-flex justify-content-between">
53+
<div>{{ 'Enabled'|trans }}</div>
54+
<div>
55+
{% if user.enabled %}
56+
<i class="text-success fas fa-check"></i>
57+
{% else %}
58+
<i class="text-danger fas fa-times"></i>
59+
{% endif %}
60+
</div>
61+
</div>
62+
</div>
63+
<div class="card-footer">
64+
<a class="text-nowrap btn btn-outline-primary me-3 px-3" href="{{ path('user_admin_edit', {user: user.id}) }}">
65+
<i class="fas fa-edit" title="{{ 'Edit user'|trans }}" data-controller="tooltip" data-bs-placement="top"></i>
7366
</a>
74-
</td>
75-
{% endif %}
76-
</tr>
67+
{% if is_granted('ROLE_ADMIN') %}
68+
<a class="text-nowrap btn btn-outline-primary px-3" href="{{ impersonation_path(user.username) }}" data-turbo-prefetch="false">
69+
<i class="fas fa-sign-in-alt" title="{{ 'Switch to user'|trans }}" data-controller="tooltip" data-bs-placement="top"></i>
70+
</a>
71+
{% endif %}
72+
</div>
73+
</div>
74+
</div>
7775
{% endfor %}
78-
</tbody>
79-
</table>
76+
</div>
8077

8178
<div class="d-flex justify-content-center">
8279
{{ pagination(users) }}

0 commit comments

Comments
 (0)