From e2c1a9bb9f51a39ad037819b2f4c88e54780a1ab Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Fri, 30 Oct 2015 10:36:27 +0100 Subject: [PATCH] Adding customfileds config in the Admin section menu --- Controller/AdminController.php | 37 +++++++++++++++++++ Resources/config/routing/customfield.yml | 16 ++++++-- .../routing/customfieldsdefaultgroup.yml | 2 +- .../config/routing/customfieldsgroup.yml | 2 +- Resources/views/Admin/layout.html.twig | 31 ++++++++++++++++ Resources/views/Admin/menu.html.twig | 20 ++++++++++ Resources/views/CustomField/edit.html.twig | 2 +- Resources/views/CustomField/index.html.twig | 2 +- Resources/views/CustomField/new.html.twig | 2 +- Resources/views/CustomField/show.html.twig | 2 +- .../CustomFieldsDefaultGroup/list.html.twig | 2 +- .../views/CustomFieldsGroup/edit.html.twig | 2 +- .../views/CustomFieldsGroup/index.html.twig | 2 +- .../views/CustomFieldsGroup/new.html.twig | 2 +- .../views/CustomFieldsGroup/show.html.twig | 2 +- 15 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 Controller/AdminController.php create mode 100644 Resources/views/Admin/layout.html.twig create mode 100644 Resources/views/Admin/menu.html.twig diff --git a/Controller/AdminController.php b/Controller/AdminController.php new file mode 100644 index 000000000..b538d9092 --- /dev/null +++ b/Controller/AdminController.php @@ -0,0 +1,37 @@ + + * + * 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 . + */ + +namespace Chill\CustomFieldsBundle\Controller; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Bundle\FrameworkBundle\Controller\Controller; + +/** + * Controller for the custom fields configuration section (in + * the admin) + * + */ +class AdminController extends Controller +{ + public function indexAction() + { + return $this->render('ChillCustomFieldsBundle:Admin:layout.html.twig'); + } +} \ No newline at end of file diff --git a/Resources/config/routing/customfield.yml b/Resources/config/routing/customfield.yml index eb92fdc96..0f8e7b8d3 100644 --- a/Resources/config/routing/customfield.yml +++ b/Resources/config/routing/customfield.yml @@ -1,11 +1,21 @@ -customfield: +customfield_section: path: /{_locale}/admin/customfield/ + defaults: { _controller: "ChillCustomFieldsBundle:Admin:index" } + options: + menus: + admin_section: + order: 1000 + label: "Custom fields configuration" + icons: ['asterisk'] + +customfield: + path: /{_locale}/admin/customfield/list defaults: { _controller: "ChillCustomFieldsBundle:CustomField:index" } options: menus: - admin: + admin_custom_fields: order: 1000 - label: "CustomFields" + label: "CustomFields List" customfield_show: path: /{_locale}/admin/customfield/{id}/show diff --git a/Resources/config/routing/customfieldsdefaultgroup.yml b/Resources/config/routing/customfieldsdefaultgroup.yml index d16434e8d..9919337af 100644 --- a/Resources/config/routing/customfieldsdefaultgroup.yml +++ b/Resources/config/routing/customfieldsdefaultgroup.yml @@ -3,7 +3,7 @@ customfieldsdefaultgroup: defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsDefaultGroup:list" } options: menus: - admin: + admin_custom_fields: order: 1000 label: "CustomFields Default Groups : List" diff --git a/Resources/config/routing/customfieldsgroup.yml b/Resources/config/routing/customfieldsgroup.yml index c8a992856..f34e0169b 100644 --- a/Resources/config/routing/customfieldsgroup.yml +++ b/Resources/config/routing/customfieldsgroup.yml @@ -3,7 +3,7 @@ customfieldsgroup: defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" } options: menus: - admin: + admin_custom_fields: order: 1010 label: "CustomFields Groups" diff --git a/Resources/views/Admin/layout.html.twig b/Resources/views/Admin/layout.html.twig new file mode 100644 index 000000000..27c0c61ac --- /dev/null +++ b/Resources/views/Admin/layout.html.twig @@ -0,0 +1,31 @@ +{# + * 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 "ChillMainBundle::Admin/layoutWithVerticalMenu.html.twig" %} + +{% block vertical_menu_content %} + {{ chill_menu('admin_custom_fields', { + 'layout': 'ChillCustomFieldsBundle::Admin/menu.html.twig', + }) }} +{% endblock %} + +{% block layout_wvm_content %} + {% block admin_content %} +

{{ 'CustomFields configuration' |trans }}

+ {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/Resources/views/Admin/menu.html.twig b/Resources/views/Admin/menu.html.twig new file mode 100644 index 000000000..aeefd1013 --- /dev/null +++ b/Resources/views/Admin/menu.html.twig @@ -0,0 +1,20 @@ +{# + * 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 "ChillMainBundle::Menu/verticalMenu.html.twig" %} +{% block v_menu_title %}{{ 'Custom fields configuration menu'|trans }}{% endblock %} \ No newline at end of file diff --git a/Resources/views/CustomField/edit.html.twig b/Resources/views/CustomField/edit.html.twig index 47f98ee92..bcc2e5d88 100644 --- a/Resources/views/CustomField/edit.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomField edit

diff --git a/Resources/views/CustomField/index.html.twig b/Resources/views/CustomField/index.html.twig index 1802c3a9c..36c5f1243 100644 --- a/Resources/views/CustomField/index.html.twig +++ b/Resources/views/CustomField/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomField list

diff --git a/Resources/views/CustomField/new.html.twig b/Resources/views/CustomField/new.html.twig index 771abbd10..a94f16b3b 100644 --- a/Resources/views/CustomField/new.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomField creation

diff --git a/Resources/views/CustomField/show.html.twig b/Resources/views/CustomField/show.html.twig index 451a544db..69a4d9e25 100644 --- a/Resources/views/CustomField/show.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomField

diff --git a/Resources/views/CustomFieldsDefaultGroup/list.html.twig b/Resources/views/CustomFieldsDefaultGroup/list.html.twig index 560aedc8d..036bc04d5 100644 --- a/Resources/views/CustomFieldsDefaultGroup/list.html.twig +++ b/Resources/views/CustomFieldsDefaultGroup/list.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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomFieldsDefaultGroup list

diff --git a/Resources/views/CustomFieldsGroup/edit.html.twig b/Resources/views/CustomFieldsGroup/edit.html.twig index 57f86745e..3197f9d90 100644 --- a/Resources/views/CustomFieldsGroup/edit.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomFieldsGroup edit

diff --git a/Resources/views/CustomFieldsGroup/index.html.twig b/Resources/views/CustomFieldsGroup/index.html.twig index bea9b6409..4f751490d 100644 --- a/Resources/views/CustomFieldsGroup/index.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomFieldsGroup list

diff --git a/Resources/views/CustomFieldsGroup/new.html.twig b/Resources/views/CustomFieldsGroup/new.html.twig index b83aec347..19ab309f6 100644 --- a/Resources/views/CustomFieldsGroup/new.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomFieldsGroup creation

diff --git a/Resources/views/CustomFieldsGroup/show.html.twig b/Resources/views/CustomFieldsGroup/show.html.twig index 5fd8681bb..84a0141d2 100644 --- a/Resources/views/CustomFieldsGroup/show.html.twig +++ b/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 "ChillMainBundle::Admin/layout.html.twig" %} +{% extends "ChillCustomFieldsBundle::Admin/layout.html.twig" %} {% block admin_content %}

CustomFieldsGroup