update crud of categories
This commit is contained in:
parent
ce25a107f4
commit
1c88ab7ac8
|
@ -39,7 +39,6 @@ class CategoryAdminController extends CrudController
|
||||||
->setPageRoute('filter', 'admin_blog_category_filter')
|
->setPageRoute('filter', 'admin_blog_category_filter')
|
||||||
->setPageRoute('batch', 'admin_blog_category_batch')
|
->setPageRoute('batch', 'admin_blog_category_batch')
|
||||||
|
|
||||||
|
|
||||||
->setForm('edit', CategoryType::class, [])
|
->setForm('edit', CategoryType::class, [])
|
||||||
->setForm('new', CategoryType::class)
|
->setForm('new', CategoryType::class)
|
||||||
|
|
||||||
|
@ -65,10 +64,10 @@ class CategoryAdminController extends CrudController
|
||||||
->setField('index', 'Status', ButtonField::class, [
|
->setField('index', 'Status', ButtonField::class, [
|
||||||
'sort' => ['isActive', '.isActive'],
|
'sort' => ['isActive', '.isActive'],
|
||||||
'attr' => ['class' => 'miw-100'],
|
'attr' => ['class' => 'miw-100'],
|
||||||
'property_builder' => function(EntityInterface $entity) {
|
'property_builder' => function (EntityInterface $entity) {
|
||||||
return $entity->getIsActive() ? 'Actif' : 'Non actif';
|
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');
|
$class = 'btn btn-sm '.($entity->getIsActive() ? 'btn-success' : 'btn-secondary');
|
||||||
|
|
||||||
return ['class' => $class];
|
return ['class' => $class];
|
||||||
|
|
|
@ -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>
|
|
Loading…
Reference in a new issue