update crud of categories

This commit is contained in:
Simon Vieille 2022-02-03 23:56:01 +01:00
parent ce25a107f4
commit 1c88ab7ac8
2 changed files with 2 additions and 10 deletions

View file

@ -39,7 +39,6 @@ class CategoryAdminController extends CrudController
->setPageRoute('filter', 'admin_blog_category_filter')
->setPageRoute('batch', 'admin_blog_category_batch')
->setForm('edit', CategoryType::class, [])
->setForm('new', CategoryType::class)
@ -65,10 +64,10 @@ class CategoryAdminController extends CrudController
->setField('index', 'Status', ButtonField::class, [
'sort' => ['isActive', '.isActive'],
'attr' => ['class' => 'miw-100'],
'property_builder' => function(EntityInterface $entity) {
'property_builder' => function (EntityInterface $entity) {
return $entity->getIsActive() ? 'Actif' : 'Non actif';
},
'button_attr_builder' => function(EntityInterface $entity) {
'button_attr_builder' => function (EntityInterface $entity) {
$class = 'btn btn-sm '.($entity->getIsActive() ? 'btn-success' : 'btn-secondary');
return ['class' => $class];

View file

@ -1,7 +0,0 @@
{% set map = {
0: ['warning', 'Brouillon'],
1: ['success', 'Publié'],
} %}
<button class="btn btn-sm btn-{{ map[entity.status].0 }}">
{{ map[entity.status].1 }}
</button>