diff --git a/Controller/CustomFieldController.php b/Controller/CustomFieldController.php index 98b8b1c96..204652612 100644 --- a/Controller/CustomFieldController.php +++ b/Controller/CustomFieldController.php @@ -4,7 +4,6 @@ namespace Chill\CustomFieldsBundle\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; -use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldsGroupToIdTransformer; use Chill\CustomFieldsBundle\Entity\CustomField; /** @@ -14,40 +13,6 @@ use Chill\CustomFieldsBundle\Entity\CustomField; class CustomFieldController extends Controller { - /** - * Lists all CustomField entities. - * - */ - public function indexAction() - { - $em = $this->getDoctrine()->getManager(); - - $entities = $em->getRepository('ChillCustomFieldsBundle:CustomField')->findAll(); - - //prepare form for new custom type - $fieldChoices = array(); - foreach ($this->get('chill.custom_field.provider')->getAllFields() - as $key => $customType) { - $fieldChoices[$key] = $customType->getName(); - } - $form = $this->get('form.factory') - ->createNamedBuilder(null, 'form', null, array( - 'method' => 'GET', - 'action' => $this->generateUrl('customfield_new'), - 'csrf_protection' => false - )) - ->add('type', 'choice', array( - 'choices' => $fieldChoices - )) - ->getForm(); - - return $this->render('ChillCustomFieldsBundle:CustomField:index.html.twig', array( - 'entities' => $entities, - 'form' => $form->createView() - )); - } - - /** * Creates a new CustomField entity. * @@ -124,6 +89,7 @@ class CustomFieldController extends Controller /** * Finds and displays a CustomField entity. * + * @deprecated is not used since there is no link to show action */ public function showAction($id) { @@ -135,12 +101,8 @@ class CustomFieldController extends Controller throw $this->createNotFoundException('Unable to find CustomField entity.'); } - $deleteForm = $this->createDeleteForm($id); - return $this->render('ChillCustomFieldsBundle:CustomField:show.html.twig', array( - 'entity' => $entity, - 'delete_form' => $deleteForm->createView(), - )); + 'entity' => $entity, )); } /** @@ -158,12 +120,10 @@ class CustomFieldController extends Controller } $editForm = $this->createEditForm($entity, $entity->getType()); - $deleteForm = $this->createDeleteForm($id); return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), )); } @@ -179,7 +139,8 @@ class CustomFieldController extends Controller $form = $this->createForm('custom_field_choice', $entity, array( 'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())), 'method' => 'PUT', - 'type' => $type + 'type' => $type, + 'group_widget' => 'hidden' )); $form->add('submit', 'submit', array('label' => 'Update')); @@ -200,7 +161,6 @@ class CustomFieldController extends Controller throw $this->createNotFoundException('Unable to find CustomField entity.'); } - $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity, $entity->getType()); $editForm->handleRequest($request); @@ -213,48 +173,6 @@ class CustomFieldController extends Controller return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( 'entity' => $entity, 'edit_form' => $editForm->createView(), - 'delete_form' => $deleteForm->createView(), )); } - /** - * Deletes a CustomField entity. - * - */ - public function deleteAction(Request $request, $id) - { - $form = $this->createDeleteForm($id); - $form->handleRequest($request); - - if ($form->isValid()) { - $em = $this->getDoctrine()->getManager(); - $entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id); - - if (!$entity) { - throw $this->createNotFoundException('Unable to find CustomField entity.'); - } - - $em->remove($entity); - $em->flush(); - } - - return $this->redirect($this->generateUrl('customfield')); - } - - /** - * Creates a form to delete a CustomField entity by id. - * - * @param mixed $id The entity id - * - * @return \Symfony\Component\Form\Form The form - */ - private function createDeleteForm($id) - { - return $this->createFormBuilder() - ->setAction($this->generateUrl('customfield_delete', array('id' => $id))) - ->setMethod('DELETE') - ->add('submit', 'submit', array('label' => 'Delete')) - ->getForm() - ; - } - } diff --git a/Resources/config/routing/customfield.yml b/Resources/config/routing/customfield.yml index 0f8e7b8d3..eabef0fad 100644 --- a/Resources/config/routing/customfield.yml +++ b/Resources/config/routing/customfield.yml @@ -8,19 +8,6 @@ customfield_section: label: "Custom fields configuration" icons: ['asterisk'] -customfield: - path: /{_locale}/admin/customfield/list - defaults: { _controller: "ChillCustomFieldsBundle:CustomField:index" } - options: - menus: - admin_custom_fields: - order: 1000 - label: "CustomFields List" - -customfield_show: - path: /{_locale}/admin/customfield/{id}/show - defaults: { _controller: "ChillCustomFieldsBundle:CustomField:show" } - customfield_new: path: /{_locale}/admin/customfield/new defaults: { _controller: "ChillCustomFieldsBundle:CustomField:new" } @@ -38,8 +25,3 @@ customfield_update: path: /{_locale}/admin/customfield/{id}/update defaults: { _controller: "ChillCustomFieldsBundle:CustomField:update" } requirements: { _method: post|put } - -customfield_delete: - path: /{_locale}/admin/customfield/{id}/delete - defaults: { _controller: "ChillCustomFieldsBundle:CustomField:delete" } - requirements: { _method: post|delete } diff --git a/Resources/views/CustomField/index.html.twig b/Resources/views/CustomField/index.html.twig deleted file mode 100644 index 36c5f1243..000000000 --- a/Resources/views/CustomField/index.html.twig +++ /dev/null @@ -1,66 +0,0 @@ -{# - * Copyright (C) 2014, 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 "ChillCustomFieldsBundle::Admin/layout.html.twig" %} - -{% block admin_content %} -

CustomField list

- - - - - - - - - - - - - {% for entity in entities %} - - - - - - - - {% endfor %} - -
IdLabelTypeActiveActions
{{ entity.id }}{{ entity.name(app.request.locale) }}{{ entity.type }}{{ entity.active }} - -
- - - {% endblock %}