Remove button delete for Configuration Admin

parent 0a6300d0
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationAPIAdmin extends AbstractAdmin
class ConfigurationAPIAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_api_admin_classname';
......
<?php
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationAbstractAdmin extends AbstractAdmin
{
public function getTemplate($name)
{
switch ($name) {
// overwrite edit template so we hide delete button in actions menu
case 'edit': return '@BiopenAdmin/edit/edit_configuration.html.twig';
break;
default : return parent::getTemplate($name);
break;
}
}
}
\ No newline at end of file
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationAdmin extends AbstractAdmin
class ConfigurationAdmin extends ConfigurationAbstractAdmin
{
protected function configureFormFields(FormMapper $formMapper)
{
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationContributionsAdmin extends AbstractAdmin
class ConfigurationContributionsAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_contributions_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationFormAdmin extends AbstractAdmin
class ConfigurationFormAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_form_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationHomeAdmin extends AbstractAdmin
class ConfigurationHomeAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_home_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationInfoBarAdmin extends AbstractAdmin
class ConfigurationInfoBarAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_map_element_form_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationMailAdmin extends AbstractAdmin
class ConfigurationMailAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_mail_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationMapAdmin extends AbstractAdmin
class ConfigurationMapAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_map_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationMarkerAdmin extends AbstractAdmin
class ConfigurationMarkerAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_marker_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationStyleAdmin extends AbstractAdmin
class ConfigurationStyleAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_style_admin_classname';
......
......@@ -7,13 +7,13 @@
*/
namespace Biopen\CoreBundle\Admin;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Biopen\CoreBundle\Admin\ConfigurationAbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Route\RouteCollection;
class ConfigurationUserAdmin extends AbstractAdmin
class ConfigurationUserAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'biopen_core_bundle_config_login_admin_classname';
......
......@@ -11,15 +11,22 @@ use Biopen\GeoDirectoryBundle\Document\ElementStatus;
class ConfigurationAdminController extends Controller
{
public function listAction()
{
$em = $this->get('doctrine_mongodb')->getManager();
$configuration = $em->getRepository('BiopenCoreBundle:Configuration')->findConfiguration();
public function listAction()
{
$em = $this->get('doctrine_mongodb')->getManager();
$configuration = $em->getRepository('BiopenCoreBundle:Configuration')->findConfiguration();
if ($configuration)
return $this->redirect($this->admin->generateUrl('edit', ['id' => $configuration->getId()]));
else
return $this->redirect($this->admin->generateUrl('create'));
}
if ($configuration)
return $this->redirect($this->admin->generateUrl('edit', ['id' => $configuration->getId()]));
else
return $this->redirect($this->admin->generateUrl('create'));
}
public function deleteAction($id)
{
// do nothing
$this->addFlash('sonata_flash_error', "Impossible de supprimer la configuration, cette action est interdite car est elle casserait toute votre carte");
return $this->redirect($this->admin->generateUrl('edit', ['id' => $id]));
}
}
\ No newline at end of file
{% extends '@BiopenAdmin/core_custom/base_edit.html.twig' %}
{% block actions %}
{% endblock %}
{% block sonata_form_actions %}
{% if admin.hasroute('edit') and admin.isGranted('EDIT') %}
<button class="btn btn-success" type="submit" name="btn_update_and_edit"><i class="fa fa-save" aria-hidden="true"></i> Mettre à jour</button>
{% endif %}
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment