diff --git a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php index 79abbbcce..a2abc59ae 100644 --- a/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillActivityBundle/Menu/AdminMenuBuilder.php @@ -59,6 +59,6 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface public static function getMenuIds(): array { - return ['admin_index', 'admin_section', 'admin_activity']; + return ['admin_section', 'admin_activity']; } } diff --git a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php index 98e22d1ef..9c9ca7872 100644 --- a/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php +++ b/src/Bundle/ChillCustomFieldsBundle/DependencyInjection/ChillCustomFieldsExtension.php @@ -34,6 +34,7 @@ class ChillCustomFieldsExtension extends Extension implements PrependExtensionIn $loader->load('services/fixtures.yaml'); $loader->load('services/controller.yaml'); $loader->load('services/command.yaml'); + $loader->load('services/menu.yaml'); //add at least a blank array at 'customizable_entities' options //$customizable_entities = (isset($config['customizables_entities']) diff --git a/src/Bundle/ChillCustomFieldsBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillCustomFieldsBundle/Menu/AdminMenuBuilder.php new file mode 100644 index 000000000..2e2d11f6f --- /dev/null +++ b/src/Bundle/ChillCustomFieldsBundle/Menu/AdminMenuBuilder.php @@ -0,0 +1,55 @@ +authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if (!$this->authorizationChecker->isGranted('ROLE_ADMIN')) { + return; + } + + $menu->addChild('Custom fields', [ + 'route' => 'customfield_section', + ]) + ->setAttribute('class', 'list-group-item-header') + ->setExtras(['order' => 4500]); + + $menu->addChild('Custom fields group', [ + 'route' => 'customfield_section', + ])->setExtras(['order' => 4510]); + + $menu->addChild('Custom fields group', [ + 'route' => 'customfieldsgroup', + ])->setExtras(['order' => 4520]); + } + + public static function getMenuIds(): array + { + return ['admin_section', 'admin_custom_fields']; + } +} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/layout.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/layout.html.twig index 3e12173fc..46f100848 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/layout.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/layout.html.twig @@ -1,26 +1,8 @@ -{# - * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, - / - * - * 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 . -#} - {% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %} {% block vertical_menu_content %} {{ chill_menu('admin_custom_fields', { - 'layout': '@ChillCustomFields/Admin/menu.html.twig', + 'layout': '@ChillMain/Admin/menu_admin_section.html.twig', }) }} {% endblock %} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/menu.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/menu.html.twig deleted file mode 100644 index 5bef800fc..000000000 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/Admin/menu.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{# - * Copyright (C) 2014-2015, Champs Libres Cooperative SCRLFS, - / - * - * 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 . -#} - -{% extends "@ChillMain/Menu/verticalMenu.html.twig" %} -{% block v_menu_title %}{{ 'Custom fields configuration menu'|trans }}{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/edit.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/edit.html.twig index 17180762b..26ee56a64 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/edit.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/edit.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'CustomField edit'|trans }}{% endblock title %} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/new.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/new.html.twig index b45aaa5c1..987f3f5d9 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/new.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/new.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'CustomField creation'|trans }}{% endblock title %} @@ -39,7 +39,7 @@ {% endif %} {{ form_row(form.submit, {'attr': { 'class': 'btn btn-create' } } ) }} {{ form_end(form) }} - +
  • {% if entity.customFieldsGroup is not null %} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/show.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/show.html.twig index 33f1a0f79..acf66ecc3 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/show.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomField/show.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block admin_content %}

    CustomField

    diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/edit.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/edit.html.twig index 2760ba9a0..0cb190531 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/edit.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/edit.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'CustomFieldsGroup edit'|trans }}{% endblock %} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/index.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/index.html.twig index 8ca67a721..2b3bb634f 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/index.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/index.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'CustomFieldsGroup list'|trans }}{% endblock %} diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/new.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/new.html.twig index fe5f91734..16cf10581 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/new.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/new.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block admin_content %}

    {{ 'CustomFieldsGroup creation'|trans }}

    diff --git a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/show.html.twig b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/show.html.twig index 38d819ab2..fe211e3f7 100644 --- a/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/show.html.twig +++ b/src/Bundle/ChillCustomFieldsBundle/Resources/views/CustomFieldsGroup/show.html.twig @@ -14,7 +14,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . #} -{% extends "@ChillCustomFields/Admin/layout.html.twig" %} +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} {% block title %}{{ 'CustomFieldsGroup details'|trans }}{% endblock %} @@ -62,9 +62,9 @@
- +

{{ 'Fields associated with this group'|trans }}

- + {%- if entity.customFields|length > 0 -%} diff --git a/src/Bundle/ChillCustomFieldsBundle/config/routes/customfield.yaml b/src/Bundle/ChillCustomFieldsBundle/config/routes/customfield.yaml index 1265e1e7d..a000b2a3a 100644 --- a/src/Bundle/ChillCustomFieldsBundle/config/routes/customfield.yaml +++ b/src/Bundle/ChillCustomFieldsBundle/config/routes/customfield.yaml @@ -1,12 +1,6 @@ customfield_section: path: /{_locale}/admin/customfield/ defaults: { _controller: "ChillCustomFieldsBundle:Admin:index" } - options: - menus: - admin_section: - order: 1000 - label: "Custom fields configuration" - icons: ['asterisk'] customfield_new: path: /{_locale}/admin/customfield/new diff --git a/src/Bundle/ChillCustomFieldsBundle/config/routes/customfieldsgroup.yaml b/src/Bundle/ChillCustomFieldsBundle/config/routes/customfieldsgroup.yaml index 9150c5349..9c34f8d44 100644 --- a/src/Bundle/ChillCustomFieldsBundle/config/routes/customfieldsgroup.yaml +++ b/src/Bundle/ChillCustomFieldsBundle/config/routes/customfieldsgroup.yaml @@ -1,11 +1,6 @@ customfieldsgroup: path: /{_locale}/admin/customfieldsgroup/ defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" } - options: - menus: - admin_custom_fields: - order: 1010 - label: "CustomFields Groups" customfieldsgroup_show: path: /{_locale}/admin/customfieldsgroup/{id}/show diff --git a/src/Bundle/ChillCustomFieldsBundle/config/services/menu.yaml b/src/Bundle/ChillCustomFieldsBundle/config/services/menu.yaml new file mode 100644 index 000000000..5c6e80734 --- /dev/null +++ b/src/Bundle/ChillCustomFieldsBundle/config/services/menu.yaml @@ -0,0 +1,7 @@ +services: + Chill\CustomFieldsBundle\Menu\: + autowire: true + autoconfigure: true + resource: '../../Menu/' + tags: ['chill.menu_builder'] + diff --git a/src/Bundle/ChillCustomFieldsBundle/translations/messages.fr.yml b/src/Bundle/ChillCustomFieldsBundle/translations/messages.fr.yml index 446176c51..31463fccb 100644 --- a/src/Bundle/ChillCustomFieldsBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCustomFieldsBundle/translations/messages.fr.yml @@ -37,16 +37,17 @@ CustomFields List: Liste des champs personnalisés CustomFields Groups: Groupe de champs personnalisés #customfield administration +Custom fields: Champs personnalisés CustomField edit: Modification d'un champ personnalisé CustomField creation: Nouveau champ personnalisé General informations: Informations générales Options: Options -Custom fields group: Groupe de champ personnalisé +Custom fields group: Groupe de champs personnalisés Ordering: Ordre d'apparition Required field: Champs requis An answer is required: Une réponse est requise Any answer is required: Aucune réponse n'est requise -Back to the group: Retour au groupe de champs personnalisé +Back to the group: Retour au groupe de champs personnalisés Slug: Identifiant textuel The custom field has been created: Le champ personnalisé est créé The custom field form contains errors: Le formulaire contient des erreurs