improve ux for admin configuration crud interface

This commit is contained in:
Mathieu Jaumotte 2021-02-05 22:30:23 +01:00
parent 8029b9b8ff
commit 31176f8bc8
17 changed files with 184 additions and 150 deletions

View File

@ -46,7 +46,7 @@ class EventTypeController extends AbstractController
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_eventtype_admin_show', return $this->redirect($this->generateUrl('chill_eventtype_admin',
array('id' => $entity->getId()))); array('id' => $entity->getId())));
} }
@ -176,7 +176,7 @@ class EventTypeController extends AbstractController
if ($editForm->isValid()) { if ($editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_eventtype_admin_edit', return $this->redirect($this->generateUrl('chill_eventtype_admin',
array('id' => $id))); array('id' => $id)));
} }

View File

@ -45,7 +45,7 @@ class RoleController extends AbstractController
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_role_show', return $this->redirect($this->generateUrl('chill_event_admin_role',
array('id' => $entity->getId()))); array('id' => $entity->getId())));
} }
@ -175,7 +175,7 @@ class RoleController extends AbstractController
if ($editForm->isValid()) { if ($editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_role_edit', return $this->redirect($this->generateUrl('chill_event_admin_role',
array('id' => $id))); array('id' => $id)));
} }

View File

@ -46,7 +46,7 @@ class StatusController extends AbstractController
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status_show', array('id' => $entity->getId()))); return $this->redirect($this->generateUrl('chill_event_admin_status', array('id' => $entity->getId())));
} }
return $this->render('ChillEventBundle:Status:new.html.twig', array( return $this->render('ChillEventBundle:Status:new.html.twig', array(
@ -174,7 +174,7 @@ class StatusController extends AbstractController
if ($editForm->isValid()) { if ($editForm->isValid()) {
$em->flush(); $em->flush();
return $this->redirect($this->generateUrl('chill_event_admin_status_edit', array('id' => $id))); return $this->redirect($this->generateUrl('chill_event_admin_status', array('id' => $id)));
} }
return $this->render('ChillEventBundle:Status:edit.html.twig', array( return $this->render('ChillEventBundle:Status:edit.html.twig', array(

View File

@ -17,7 +17,5 @@
#} #}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} {% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %} {% block v_menu_title %}{{ 'Events configuration menu'|trans }}{% endblock %}
{{ 'Events configuration menu'|trans }}
{% endblock %}

View File

@ -4,14 +4,18 @@
<h1>{{ 'EventType edit'|trans }}</h1> <h1>{{ 'EventType edit'|trans }}</h1>
{{ form(edit_form) }} {{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_eventtype_admin') }}"> <a href="{{ path('chill_eventtype_admin') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(edit_form.submit, { 'attr': { 'class' : 'sc-button bt-edit' }}) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{{ form_end(edit_form) }}
{% endblock %} {% endblock %}

View File

@ -7,10 +7,10 @@
<table class="records_list"> <table class="records_list">
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<th>Label</th> <th>{{ 'Label'|trans }}</th>
<th>Active</th> <th>{{ 'Active'|trans }}</th>
<th>Actions</th> <th>{{ 'Actions'|trans }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -20,12 +20,12 @@
<td>{{ entity.name|localize_translatable_string }}</td> <td>{{ entity.name|localize_translatable_string }}</td>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
<td> <td>
<ul> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_eventtype_admin_show', { 'id': entity.id }) }}">show</a> <a href="{{ path('chill_eventtype_admin_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
</li> </li>
<li> <li>
<a href="{{ path('chill_eventtype_admin_show', { 'id': entity.id }) }}">edit</a> <a href="{{ path('chill_eventtype_admin_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
</li> </li>
</ul> </ul>
</td> </td>
@ -34,11 +34,9 @@
</tbody> </tbody>
</table> </table>
<ul> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_eventtype_admin_new') }}"> <a href="{{ path('chill_eventtype_admin_new') }}" class="sc-button bt-new">{{ 'Create a new type'|trans }}</a>
Create a new entry
</a>
</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -4,13 +4,18 @@
<h1>{{ 'EventType creation'|trans }}</h1> <h1>{{ 'EventType creation'|trans }}</h1>
{{ form(form) }} {{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_eventtype_admin') }}"> <a href="{{ path('chill_eventtype_admin') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(form.submit, { 'attr': { 'class' : 'sc-button bt-new' }}) }}
</ul> </li>
</ul>
{{ form_end(form) }}
{% endblock %} {% endblock %}

View File

@ -7,31 +7,31 @@
<table class="record_properties"> <table class="record_properties">
<tbody> <tbody>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<td>{{ entity.id }}</td> <td>{{ entity.id }}</td>
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>{{ 'Name'|trans }}</th>
<td>{{ entity.name|localize_translatable_string }}</td> <td>{{ entity.name|localize_translatable_string }}</td>
</tr> </tr>
<tr> <tr>
<th>Active</th> <th>{{ 'Active'|trans }}</th>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_eventtype_admin') }}"> <a href="{{ path('chill_eventtype_admin') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> <a href="{{ path('chill_eventtype_admin_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">{{ 'Edit'|trans }}</a>
<li> </li>
<a href="{{ path('chill_eventtype_admin_edit', { 'id': entity.id }) }}"> <li>
Edit {{ form_start(delete_form) }}
</a> {{ form_row(delete_form.submit, { 'attr': { 'class' : 'sc-button bt-delete' }}) }}
</li> {{ form_end(delete_form) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -1,17 +1,21 @@
{% extends "ChillEventBundle:Admin:layout.html.twig" %} {% extends "ChillEventBundle:Admin:layout.html.twig" %}
{% block admin_content -%} {% block admin_content -%}
<h1>{{ 'Role edit'|trans }}</h1> <h1>{{ 'Role edit'|trans }}</h1>
{{ form(edit_form) }} {{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.type) }}
{{ form_row(edit_form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_role') }}"> <a href="{{ path('chill_event_admin_role') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(edit_form.submit, { 'attr': { 'class' : 'sc-button bt-edit' }}) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{{ form_end(edit_form) }}
{% endblock %} {% endblock %}

View File

@ -7,11 +7,11 @@
<table class="records_list"> <table class="records_list">
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<th>Name</th> <th>{{ 'Role'|trans }}</th>
<th>Type</th> <th>{{ 'Type'|trans }}</th>
<th>Active</th> <th>{{ 'Active'|trans }}</th>
<th>Actions</th> <th>{{ 'Actions'|trans }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -22,25 +22,23 @@
<td>{{ entity.type.name|localize_translatable_string }}</td> <td>{{ entity.type.name|localize_translatable_string }}</td>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
<td> <td>
<ul> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_event_admin_role_show', { 'id': entity.id }) }}">show</a> <a href="{{ path('chill_event_admin_role_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
</li> </li>
<li> <li>
<a href="{{ path('chill_event_admin_role_edit', { 'id': entity.id }) }}">edit</a> <a href="{{ path('chill_event_admin_role_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
</li> </li>
</ul> </ul>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<ul> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_event_admin_role_new') }}"> <a href="{{ path('chill_event_admin_role_new') }}" class="sc-button bt-new">{{ 'Create a new role'|trans }}</a>
Create a new entry
</a>
</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -4,13 +4,19 @@
<h1>{{ 'Role creation'|trans }}</h1> <h1>{{ 'Role creation'|trans }}</h1>
{{ form(form) }} {{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_role') }}"> <a href="{{ path('chill_event_admin_role') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(form.submit, { 'attr': { 'class' : 'sc-button bt-new' }}) }}
</ul> </li>
</ul>
{{ form_end(form) }}
{% endblock %} {% endblock %}

View File

@ -7,31 +7,35 @@
<table class="record_properties"> <table class="record_properties">
<tbody> <tbody>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<td>{{ entity.id }}</td> <td>{{ entity.id }}</td>
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>{{ 'Name'|trans }}</th>
<td>{{ entity.name|localize_translatable_string }}</td> <td>{{ entity.name|localize_translatable_string }}</td>
</tr> </tr>
<tr> <tr>
<th>Active</th> <th>{{ 'Type'|trans }}</th>
<td>{{ entity.type.name|localize_translatable_string }}</td>
</tr>
<tr>
<th>{{ 'Active'|trans }}</th>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_role') }}"> <a href="{{ path('chill_event_admin_role') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> <a href="{{ path('chill_event_admin_role_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">{{ 'Edit'|trans }}</a>
<li> </li>
<a href="{{ path('chill_event_admin_role_edit', { 'id': entity.id }) }}"> <li>
Edit {{ form_start(delete_form) }}
</a> {{ form_row(delete_form.submit, { 'attr': { 'class' : 'sc-button bt-delete' }}) }}
</li> {{ form_end(delete_form) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -4,14 +4,19 @@
<h1>{{ 'Status edit'|trans }}</h1> <h1>{{ 'Status edit'|trans }}</h1>
{{ form(edit_form) }} {{ form_start(edit_form) }}
{{ form_row(edit_form.name) }}
{{ form_row(edit_form.type) }}
{{ form_row(edit_form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_status') }}"> <a href="{{ path('chill_event_admin_status') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(edit_form.submit, { 'attr': { 'class' : 'sc-button bt-edit' }}) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{{ form_end(edit_form) }}
{% endblock %} {% endblock %}

View File

@ -7,11 +7,11 @@
<table class="records_list"> <table class="records_list">
<thead> <thead>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<th>Name</th> <th>{{ 'Statut'|trans }}</th>
<th>Type</th> <th>{{ 'Type'|trans }}</th>
<th>Active</th> <th>{{ 'Active'|trans }}</th>
<th>Actions</th> <th>{{ 'Actions'|trans }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -22,12 +22,12 @@
<td>{{ entity.type.name|localize_translatable_string }}</td> <td>{{ entity.type.name|localize_translatable_string }}</td>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
<td> <td>
<ul> <ul class="record_actions">
<li> <li>
<a href="{{ path('chill_event_admin_status_show', { 'id': entity.id }) }}">show</a> <a href="{{ path('chill_event_admin_status_show', { 'id': entity.id }) }}" class="sc-button bt-show" title="{{ 'show'|trans }}"></a>
</li> </li>
<li> <li>
<a href="{{ path('chill_event_admin_status_edit', { 'id': entity.id }) }}">edit</a> <a href="{{ path('chill_event_admin_status_edit', { 'id': entity.id }) }}" class="sc-button bt-edit" title="{{ 'edit'|trans }}"></a>
</li> </li>
</ul> </ul>
</td> </td>
@ -36,11 +36,9 @@
</tbody> </tbody>
</table> </table>
<ul> <ul class="record_actions sticky-form-buttons">
<li> <li>
<a href="{{ path('chill_event_admin_status_new') }}"> <a href="{{ path('chill_event_admin_status_new') }}" class="sc-button bt-new">{{ 'Create a new status'|trans }}</a>
Create a new entry
</a>
</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -4,13 +4,19 @@
<h1>{{ 'Status creation'|trans }}</h1> <h1>{{ 'Status creation'|trans }}</h1>
{{ form(form) }} {{ form_start(form) }}
{{ form_row(form.name) }}
{{ form_row(form.type) }}
{{ form_row(form.active) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_status') }}"> <a href="{{ path('chill_event_admin_status') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> {{ form_row(form.submit, { 'attr': { 'class' : 'sc-button bt-new' }}) }}
</ul> </li>
</ul>
{{ form_end(form) }}
{% endblock %} {% endblock %}

View File

@ -7,31 +7,35 @@
<table class="record_properties"> <table class="record_properties">
<tbody> <tbody>
<tr> <tr>
<th>Id</th> <th>{{ 'Id'|trans }}</th>
<td>{{ entity.id }}</td> <td>{{ entity.id }}</td>
</tr> </tr>
<tr> <tr>
<th>Name</th> <th>{{ 'Status'|trans }}</th>
<td>{{ entity.name|localize_translatable_string }}</td> <td>{{ entity.name|localize_translatable_string }}</td>
</tr> </tr>
<tr> <tr>
<th>Active</th> <th>{{ 'Type'|trans }}</th>
<td>{{ entity.type.name|localize_translatable_string }}</td>
</tr>
<tr>
<th>{{ 'Active'|trans }}</th>
<td>{{ entity.active }}</td> <td>{{ entity.active }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<ul class="record_actions"> <ul class="record_actions">
<li> <li class="cancel">
<a href="{{ path('chill_event_admin_status') }}"> <a href="{{ path('chill_event_admin_status') }}" class="sc-button bt-cancel">{{ 'Back to the list'|trans }}</a>
Back to the list </li>
</a> <li>
</li> <a href="{{ path('chill_event_admin_status_edit', { 'id': entity.id }) }}" class="sc-button bt-edit">{{ 'Edit'|trans }}</a>
<li> </li>
<a href="{{ path('chill_event_admin_status_edit', { 'id': entity.id }) }}"> <li>
Edit {{ form_start(delete_form) }}
</a> {{ form_row(delete_form.submit, { 'attr': { 'class' : 'sc-button bt-delete' }}) }}
</li> {{ form_end(delete_form) }}
<li>{{ form(delete_form) }}</li> </li>
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -104,4 +104,8 @@ Role edit: Modifier un rôle
'': '' '': ''
xlsx: xlsx xlsx: xlsx
ods: ods ods: ods
csv: csv csv: csv
Create a new role: Créer un nouveau rôle
Create a new type: Créer un nouveau type
Create a new status: Créer un nouveau statut