Skip to content

Commit

Permalink
3547: Cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Jan 10, 2025
1 parent e1f657d commit c232e7e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/Controller/Admin/AbstractCrudController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as AbstractCrudControllerBase;

abstract class AbstractCrudController extends AbstractCrudControllerBase
{
}
9 changes: 5 additions & 4 deletions src/Controller/Admin/ArchiverCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\BooleanField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField;
Expand All @@ -24,12 +23,13 @@ public static function getEntityFqcn(): string

public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined();
return parent::configureCrud($crud)
->showEntityActionsInlined();
}

public function configureActions(Actions $actions): Actions
{
return $actions
return parent::configureActions($actions)
->disable(Action::DELETE);
}

Expand All @@ -50,7 +50,8 @@ public function configureFields(string $pageName): iterable
->setFormat($this->getParameter('display_datetime_format'))
->setTimezone($this->getParameter('display_datetime_timezone'))
->hideOnForm();
yield BooleanField::new('enabled');
yield BooleanField::new('enabled')
->renderAsSwitch(false);
yield CodeEditorField::new('configuration')
->hideOnIndex()
->setLanguage('yaml')
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/Admin/ExceptionLogEntryCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\CodeEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextareaField;
Expand All @@ -21,14 +20,15 @@ public static function getEntityFqcn(): string

public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined()
return parent::configureCrud($crud)
->showEntityActionsInlined()
->setDefaultSort(['createdAt' => Criteria::DESC])
;
}

public function configureActions(Actions $actions): Actions
{
return $actions
return parent::configureActions($actions)
->disable(Action::NEW, Action::EDIT, Action::DELETE)
->add(Crud::PAGE_INDEX, Action::DETAIL);
}
Expand Down
7 changes: 4 additions & 3 deletions src/Controller/Admin/GetOrganized/DocumentCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace App\Controller\Admin\GetOrganized;

use App\Admin\Field\JsonField;
use App\Controller\Admin\AbstractCrudController;
use App\Entity\GetOrganized\Document;
use Doctrine\Common\Collections\Criteria;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
Expand All @@ -22,14 +22,15 @@ public static function getEntityFqcn(): string

public function configureCrud(Crud $crud): Crud
{
return $crud->showEntityActionsInlined()
return parent::configureCrud($crud)
->showEntityActionsInlined()
->setDefaultSort(['updatedAt' => Criteria::DESC])
;
}

public function configureActions(Actions $actions): Actions
{
return $actions
return parent::configureActions($actions)
->disable(Action::NEW, Action::EDIT, Action::DELETE)
->add(Crud::PAGE_INDEX, Action::DETAIL);
}
Expand Down

0 comments on commit c232e7e

Please sign in to comment.