improve ux in admin configuration interface

This commit is contained in:
Mathieu Jaumotte 2021-02-06 13:51:46 +01:00
parent 7ef534438e
commit 6f80bd0d37
11 changed files with 190 additions and 32 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace Chill\DocStoreBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
/**
* Class AdminController
*
* @package Chill\DocStoreBundle\Controller
*/
class AdminController extends AbstractController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction()
{
return $this->render('ChillDocStoreBundle:Admin:layout.html.twig');
}
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');
}
}

View File

@ -100,7 +100,7 @@ class DocumentCategoryController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$this->getDoctrine()->getManager()->flush();
return $this->redirectToRoute('document_category_edit', [
return $this->redirectToRoute('document_category_index', [
'bundleId' => $documentCategory->getBundleId(),
'idInsideBundle' => $documentCategory->getIdInsideBundle(),]);
}

View File

@ -0,0 +1,31 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
{% block vertical_menu_content %}
{{ chill_menu('admin_docstore', {
'layout': '@ChillDocStore/Admin/menu.html.twig',
}) }}
{% endblock %}
{% block layout_wvm_content %}
{% block admin_content %}<!-- block personcontent empty -->
<h1>{{ 'Documents configuration' |trans }}</h1>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,21 @@
{#
* Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS,
<info@champs-libres.coop> / <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
{% block v_menu_title %}{{ 'Documents configuration'|trans }}{% endblock %}

View File

@ -16,5 +16,5 @@
#}
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="sc-button bt-create">{{ button_label|default('Save') }}</button>
<button class="sc-button bt-edit">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}

View File

@ -14,18 +14,29 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layout.html.twig" %}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category edit'|trans }}{% endblock title %}
{% block admin_content %}
<h1>{{ 'Document category edit'|trans }}</h1>
{{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig', {'button_label': 'Update'}) }}
{# DISABLED
{{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig', {'button_label': 'Update'}) }}
#}
<a href="{{ path('document_category_index') }}" class="sc-button">
{{ 'Back to the category list' | trans }}
</a>
{{ form_start(form) }}
{{ form_widget(form) }}
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('document_category_index') }}" class="sc-button bt-cancel">
{{ 'Back to the category list' | trans }}
</a>
</li>
<li>
<button class="sc-button bt-edit">{{ button_label|default('Edit')|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
{{ include('ChillDocStoreBundle:DocumentCategory:_delete_form.html.twig') }}
{% endblock %}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layout.html.twig" %}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category list' | trans }}{% endblock title %}
@ -40,12 +40,10 @@
<td>{{ document_category.name | localize_translatable_string}}</td>
<td>
<a href="{{ path('document_category_show', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}" class="sc-button">
{{ 'show' | trans }}
</a>
<a href="{{ path('document_category_edit', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}" class="sc-button bt-edit">
{{ 'edit' | trans }}
</a>
<a href="{{ path('document_category_show', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}"
class="sc-button bt-show" title="{{ 'show' | trans }}"></a>
<a href="{{ path('document_category_edit', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}"
class="sc-button bt-edit" title="{{ 'edit' | trans }}"></a>
</td>
</tr>
{% else %}
@ -56,5 +54,9 @@
</tbody>
</table>
<a href="{{ path('document_category_new') }}" class="sc-button bt-create">{{ 'Create new' | trans }}</a>
<ul class="record_actions">
<li>
<a href="{{ path('document_category_new') }}" class="sc-button bt-create">{{ 'Create new category' | trans }}</a>
</li>
</ul>
{% endblock %}

View File

@ -14,16 +14,29 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layout.html.twig" %}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Create new document category' | trans }}{% endblock title %}
{% block admin_content %}
<h1>{{ 'Create new DocumentCategory' | trans }}</h1>
{{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig') }}
{# DISABLED
{{ include('ChillDocStoreBundle:DocumentCategory:_form.html.twig') }}
#}
{{ form_start(form) }}
{{ form_widget(form) }}
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('document_category_index') }}" class="sc-button bt-cancel">
{{ 'Back to the category list' | trans }}
</a>
</li>
<li>
<button class="sc-button bt-new">{{ button_label|default('New')|trans }}</button>
</li>
</ul>
{{ form_end(form) }}
<a href="{{ path('document_category_index') }}" class="sc-button">
{{ 'Back to the category list' | trans }}
</a>
{% endblock %}

View File

@ -14,12 +14,12 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "@ChillMain/Admin/layout.html.twig" %}
{% extends "ChillDocStoreBundle:Admin:layout.html.twig" %}
{% block title %}{{ 'Document category show'|trans }}{% endblock title %}
{% block admin_content %}
<h1>Document category</h1>
<h1>{{ 'Document category show'|trans }}</h1>
<table class="table">
<tbody>
@ -42,13 +42,17 @@
</tbody>
</table>
<a href="{{ path('document_category_index') }}" class="sc-button">
{{ 'Back to the category list' | trans }}
</a>
<a href="{{ path('document_category_edit', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}" class="sc-button bt-edit">
{{ 'Edit' | trans }}
</a>
{{ include('ChillDocStoreBundle:DocumentCategory:_delete_form.html.twig') }}
<ul class="record_actions">
<li class="cancel">
<a href="{{ path('document_category_index') }}"
class="sc-button bt-cancel">{{ 'Back to the category list' | trans }}</a>
</li>
<li>
<a href="{{ path('document_category_edit', {'bundleId': document_category.bundleId, 'idInsideBundle': document_category.idInsideBundle}) }}"
class="sc-button bt-edit">{{ 'Edit' | trans }}</a>
</li>
<li>
{{ include('ChillDocStoreBundle:DocumentCategory:_delete_form.html.twig') }}
</li>
</ul>
{% endblock %}

View File

@ -1,3 +1,32 @@
app:
resource: "@ChillDocStoreBundle/Controller/"
type: annotation
## ADMIN SECTION
chill_docstore_admin:
path: /{_locale}/admin/document
controller: Chill\DocStoreBundle\Controller\AdminController::indexAction
options:
menus:
admin_section:
order: 2200
label: "Documents configuration menu"
icons: ['calendar']
chill_docstore_admin_redirect_to_admin_index:
path: /{_locale}/admin/document_redirect_to_main
controller: Chill\DocStoreBundle\Controller\AdminController::redirectToAdminIndexAction
options:
menus:
admin_docstore:
order: 0
label: Main admin menu
chill_docstore_category_admin:
path: /{_locale}/admin/document/category
controller: Chill\DocStoreBundle\Controller\DocumentCategoryController::indexAction
options:
menus:
admin_docstore:
order: 90
label: "Documents categories"

View File

@ -34,3 +34,20 @@ CHILL_PERSON_DOCUMENT_DELETE: Supprimer un document
CHILL_PERSON_DOCUMENT_SEE: Voir un document
CHILL_PERSON_DOCUMENT_SEE_DETAILS: Voir le détail d'un document
CHILL_PERSON_DOCUMENT_UPDATE: Modifier un document
# Admin
Documents configuration: Configuration des documents
Documents configuration menu: Documents
Documents categories: Catégories de documents
Document category list: Catégories de documents
Document category show: Voir la catégorie de documents
Document category edit: Modifier la catégorie de documents
Creator bundle id: Module
Bundle id: Module
Internal id inside creator bundle: Identifiant
Id inside bundle: Identifiant
Document class: Classe de document
no records found:
Create new category: Créer une nouvelle catégorie
Back to the category list: Retour à la liste