symfony complete
Этот коммит содержится в:
5
templates/user/_delete_form.html.twig
Обычный файл
5
templates/user/_delete_form.html.twig
Обычный файл
@@ -0,0 +1,5 @@
|
||||
<form method="post" action="{{ path('user_delete', {'id': user.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user.id) }}">
|
||||
<button class="btn btn-danger float-right">Удалить</button>
|
||||
</form>
|
4
templates/user/_form.html.twig
Обычный файл
4
templates/user/_form.html.twig
Обычный файл
@@ -0,0 +1,4 @@
|
||||
{{ form_start(form) }}
|
||||
{{ form_widget(form) }}
|
||||
<button class="btn btn-success float-left">{{ button_label|default('Сохранить') }}</button>
|
||||
{{ form_end(form) }}
|
17
templates/user/edit.html.twig
Обычный файл
17
templates/user/edit.html.twig
Обычный файл
@@ -0,0 +1,17 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Edit User{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<a href="{{ path('user_index') }}" class="btn btn-primary mb-5">← к списку</a>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ include('user/_form.html.twig', {'button_label': 'Обновить'}) }}
|
||||
|
||||
{{ include('user/_delete_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
48
templates/user/index.html.twig
Обычный файл
48
templates/user/index.html.twig
Обычный файл
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Список пользователей{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
|
||||
<a href="{{ path('index_page') }}" class="btn btn-primary float-left mb-4">← Главная</a>
|
||||
<a href="{{ path('user_new') }}" class="btn btn-success float-right mb-4">Добавить пользователя</a>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<th>Username</th>
|
||||
<th>Роли</th>
|
||||
<th>Хеш пароля</th>
|
||||
<th>Активный</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{ user.id }}</td>
|
||||
<td>{{ user.username }}</td>
|
||||
<td>
|
||||
{% for role in user.roles %}
|
||||
{{ role }},<br>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td style="max-width: 18.75rem;"><div class="d-inline-block w-100 text-truncate" title="{{ user.password }}">{{ user.password }}</div></td>
|
||||
<td>{{ user.active ? 'Да' : 'Нет' }}</td>
|
||||
<td>
|
||||
<a href="{{ path('user_show', {'id': user.id}) }}" class="btn btn-outline-primary float-right ml-2">Просмотр</a>
|
||||
<a href="{{ path('user_edit', {'id': user.id}) }}" class="btn btn-outline-success float-right">Правка</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="6">нет записей</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
14
templates/user/new.html.twig
Обычный файл
14
templates/user/new.html.twig
Обычный файл
@@ -0,0 +1,14 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}New User{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<a href="{{ path('user_index') }}" class="btn btn-primary mb-5">← к списку</a>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ include('user/_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
42
templates/user/show.html.twig
Обычный файл
42
templates/user/show.html.twig
Обычный файл
@@ -0,0 +1,42 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Просмотр пользователя{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<a href="{{ path('user_index') }}" class="btn btn-primary mb-5">← к списку</a>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Id</th>
|
||||
<td>{{ user.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<td>{{ user.username }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Roles</th>
|
||||
<td>{% for role in user.roles %}
|
||||
{{ role }},<br>
|
||||
{% endfor %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Password</th>
|
||||
<td>{{ user.password }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Active</th>
|
||||
<td>{{ user.active ? 'Yes' : 'No' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<a href="{{ path('user_edit', {'id': user.id}) }}" class="btn btn-success float-left">Правка</a>
|
||||
{{ include('user/_delete_form.html.twig') }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
Ссылка в новой задаче
Block a user