Add users management UI

- remove the “add a user” from the config page
- add a CRUD on user
- fix some missing translations (+ bad indentation)
This commit is contained in:
Jeremy Benoist
2016-09-30 20:09:06 +02:00
parent 52c1fc7449
commit 152fcccd44
29 changed files with 956 additions and 223 deletions

View File

@ -0,0 +1,86 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'user.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'user.edit_user'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(edit_form) }}
{{ form_errors(edit_form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.name) }}
{{ form_errors(edit_form.name) }}
{{ form_widget(edit_form.name) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.username) }}
{{ form_errors(edit_form.username) }}
{{ form_widget(edit_form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(edit_form.email) }}
{{ form_errors(edit_form.email) }}
{{ form_widget(edit_form.email) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_widget(edit_form.enabled) }}
{{ form_label(edit_form.enabled) }}
{{ form_errors(edit_form.enabled) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_widget(edit_form.locked) }}
{{ form_label(edit_form.locked) }}
{{ form_errors(edit_form.locked) }}
</div>
</div>
{% if twofactor_auth %}
<div class="row">
<div class="input-field col s12">
{{ form_widget(edit_form.twoFactorAuthentication) }}
{{ form_label(edit_form.twoFactorAuthentication) }}
{{ form_errors(edit_form.twoFactorAuthentication) }}
</div>
</div>
{% endif %}
<br/>
{{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_rest(edit_form) }}
</form>
<p>
{{ form_start(delete_form) }}
<button onclick="return confirm('{{ 'user.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'user.form.delete'|trans }}</button>
{{ form_end(delete_form) }}
</p>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('user_index') }}">{{ 'user.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,48 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'user.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<p class="help">{{ 'user.description'|trans|raw }}</p>
<table class="bordered">
<thead>
<tr>
<th>{{ 'user.form.username_label'|trans }}</th>
<th>{{ 'user.form.email_label'|trans }}</th>
<th>{{ 'user.form.last_login_label'|trans }}</th>
<th>{{ 'user.form.locked_label'|trans }}</th>
<th>{{ 'user.list.actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{% if user.lastLogin %}{{ user.lastLogin|date('Y-m-d H:i:s') }}{% endif %}</td>
<td>{% if user.locked %}{{ 'user.list.yes'|trans }}{% else %}{{ 'user.list.no'|trans }}{% endif %}</td>
<td>
<a href="{{ path('user_edit', { 'id': user.id }) }}">{{ 'user.list.edit_action'|trans }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<br />
<p>
<a href="{{ path('user_new') }}" class="waves-effect waves-light btn">{{ 'user.list.create_new_one'|trans }}</a>
</p>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,61 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'user.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<h4>{{ 'user.new_user'|trans }}</h4>
<div id="set6" class="col s12">
{{ form_start(form) }}
{{ form_errors(form) }}
<div class="row">
<div class="input-field col s12">
{{ form_label(form.username) }}
{{ form_errors(form.username) }}
{{ form_widget(form.username) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.plainPassword.first) }}
{{ form_errors(form.plainPassword.first) }}
{{ form_widget(form.plainPassword.first) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.plainPassword.second) }}
{{ form_errors(form.plainPassword.second) }}
{{ form_widget(form.plainPassword.second) }}
</div>
</div>
<div class="row">
<div class="input-field col s12">
{{ form_label(form.email) }}
{{ form_errors(form.email) }}
{{ form_widget(form.email) }}
</div>
</div>
{{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
{{ form_rest(form) }}
</form>
<p><a class="waves-effect waves-light btn blue-grey" href="{{ path('user_index') }}">{{ 'user.form.back_to_list'|trans }}</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,43 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{{ 'user.manage.page_title'|trans }}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel">
<div class="row">
<div class="input-field col s12">
<p class="help">{{ 'user.manage.description'|trans|raw }}</p>
<table class="bordered">
<thead>
<tr>
<th>{{ 'user.manage.field.username'|trans }}</th>
<th>{{ 'user.manage.field.email'|trans }}</th>
<th>{{ 'user.manage.field.last_login'|trans }}</th>
<th>{{ 'user.manage.field.locked'|trans }}</th>
<th>{{ 'user.manage.action'|trans }}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>{{ user.lastLogin|date('d/m/Y H:i:s') }}</td>
<td>{{ user.locked ? 'yes' : 'no' }}</td>
<td>edit - delete</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
{% endblock %}