mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-06 07:49:53 +00:00
Add delete functionality in admin for news item
This commit is contained in:
parent
229cef8942
commit
e876b75d41
@ -562,10 +562,17 @@ class ChillMainExtension extends Extension implements
|
|||||||
'role' => 'ROLE_ADMIN',
|
'role' => 'ROLE_ADMIN',
|
||||||
'template' => '@ChillMain/NewsItem/new.html.twig',
|
'template' => '@ChillMain/NewsItem/new.html.twig',
|
||||||
],
|
],
|
||||||
|
'view' => [
|
||||||
|
'role' => '',
|
||||||
|
],
|
||||||
'edit' => [
|
'edit' => [
|
||||||
'role' => 'ROLE_ADMIN',
|
'role' => 'ROLE_ADMIN',
|
||||||
'template' => '@ChillMain/NewsItem/edit.html.twig',
|
'template' => '@ChillMain/NewsItem/edit.html.twig',
|
||||||
],
|
],
|
||||||
|
'delete' => [
|
||||||
|
'role' => 'ROLE_ADMIN',
|
||||||
|
'template' => '@ChillMain/NewsItem/delete.html.twig',
|
||||||
|
]
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
|
||||||
|
|
||||||
|
{% block admin_content %}
|
||||||
|
{% embed '@ChillMain/CRUD/delete.html.twig' %}
|
||||||
|
{% endembed %}
|
||||||
|
{% endblock admin_content %}
|
@ -22,6 +22,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_news_item_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
<a href="{{ path('chill_crud_news_item_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ path('chill_crud_news_item_delete', { 'id': entity.id }) }}" class="btn btn-delete" title="{{ 'delete'|trans }}"></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\Templating\Entity;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Entity\NewsItem;
|
||||||
|
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements ChillEntityRenderInterface<NewsItem>
|
||||||
|
*/
|
||||||
|
final readonly class NewsItemRender implements ChillEntityRenderInterface
|
||||||
|
{
|
||||||
|
public function __construct(private TranslatableStringHelper $translatableStringHelper, private \Twig\Environment $engine) {}
|
||||||
|
|
||||||
|
public function renderBox($entity, array $options): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function renderString($entity, array $options): string
|
||||||
|
{
|
||||||
|
return $entity->getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supports($newsItem, array $options): bool
|
||||||
|
{
|
||||||
|
return $newsItem instanceof NewsItem;
|
||||||
|
}
|
||||||
|
}
|
@ -47,6 +47,8 @@ services:
|
|||||||
|
|
||||||
Chill\MainBundle\Templating\Entity\AddressRender: ~
|
Chill\MainBundle\Templating\Entity\AddressRender: ~
|
||||||
|
|
||||||
|
Chill\MainBundle\Templating\Entity\NewsItemRender: ~
|
||||||
|
|
||||||
Chill\MainBundle\Templating\Entity\UserRender: ~
|
Chill\MainBundle\Templating\Entity\UserRender: ~
|
||||||
|
|
||||||
Chill\MainBundle\Templating\Listing\:
|
Chill\MainBundle\Templating\Listing\:
|
||||||
|
@ -436,6 +436,9 @@ crud:
|
|||||||
add_new: Créer une nouvelle actualité
|
add_new: Créer une nouvelle actualité
|
||||||
title_new: Nouvelle actualité
|
title_new: Nouvelle actualité
|
||||||
title_edit: Modifier une actualité
|
title_edit: Modifier une actualité
|
||||||
|
title_delete: Supprimer une actualité
|
||||||
|
button_delete: Supprimer
|
||||||
|
confirm_message_delete: Êtes-vous sûr de vouloir supprimer l'actualité, "%as_string%" ?
|
||||||
|
|
||||||
No entities: Aucun élément
|
No entities: Aucun élément
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user