mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix delete workflow
This commit is contained in:
parent
ffe4dd4a98
commit
b56d8c2956
@ -23,7 +23,7 @@ use Chill\MainBundle\Workflow\Validator\StepDestValid;
|
|||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
@ -114,24 +114,22 @@ class WorkflowController extends AbstractController
|
|||||||
$this->denyAccessUnlessGranted(EntityWorkflowVoter::DELETE, $entityWorkflow);
|
$this->denyAccessUnlessGranted(EntityWorkflowVoter::DELETE, $entityWorkflow);
|
||||||
|
|
||||||
$form = $this->createForm(FormType::class);
|
$form = $this->createForm(FormType::class);
|
||||||
|
$form->add('submit', SubmitType::class, ['label' => 'workflow.Delete workflow']);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$this->entityManager->remove($entityWorkflow);;
|
$this->entityManager->remove($entityWorkflow);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
$this->addFlash('success', $this->translator->trans('workflow.Workflow deleted with success'));
|
$this->addFlash('success', $this->translator->trans('workflow.Workflow deleted with success'));
|
||||||
|
|
||||||
if ($request->query->has('returnPath')) {
|
return $this->redirectToRoute('chill_main_homepage');
|
||||||
return new RedirectResponse($request->query->get('returnPath'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirectToRoute('homepage');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('@ChillMain/Workflow/delete.html.twig', [
|
return $this->render('@ChillMain/Workflow/delete.html.twig', [
|
||||||
'entityWorkflow' => $entityWorkflow,
|
'entityWorkflow' => $entityWorkflow,
|
||||||
'delete_form' => $form->createView(),
|
'delete_form' => $form->createView(),
|
||||||
|
'handler' => $this->entityWorkflowManager->getHandler($entityWorkflow),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,21 @@
|
|||||||
|
|
||||||
{% block title 'workflow.Delete workflow ?'|trans %}
|
{% block title 'workflow.Delete workflow ?'|trans %}
|
||||||
|
|
||||||
|
{% block display_content %}
|
||||||
|
<h2>
|
||||||
|
{{ 'workflow_'|trans }}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
{% include handler.templateTitle(entityWorkflow) with handler.templateTitleData(entityWorkflow)|merge({
|
||||||
|
'description': true,
|
||||||
|
'add_classes': 'ms-3 h3'
|
||||||
|
}) %}
|
||||||
|
|
||||||
|
{% include handler.template(entityWorkflow) with handler.templateData(entityWorkflow)|merge({
|
||||||
|
'display_action': false
|
||||||
|
}) %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="container chill-md-10">
|
<div class="container chill-md-10">
|
||||||
@ -9,6 +24,7 @@
|
|||||||
{
|
{
|
||||||
'title' : 'workflow.Delete workflow ?'|trans,
|
'title' : 'workflow.Delete workflow ?'|trans,
|
||||||
'confirm_question' : 'workflow.Are you sure you want to delete this workflow ?'|trans,
|
'confirm_question' : 'workflow.Are you sure you want to delete this workflow ?'|trans,
|
||||||
|
'display_content' : block('display_content'),
|
||||||
'cancel_route' : 'chill_main_workflow_show',
|
'cancel_route' : 'chill_main_workflow_show',
|
||||||
'cancel_parameters' : {'id' : entityWorkflow.id},
|
'cancel_parameters' : {'id' : entityWorkflow.id},
|
||||||
'form' : delete_form
|
'form' : delete_form
|
||||||
|
@ -41,7 +41,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<a class="btn btn-delete"
|
<a class="btn btn-delete"
|
||||||
href="{{ chill_path_add_return_path('chill_main_workflow_delete', {'id': entity_workflow.id}) }}"
|
href="{{ chill_path_add_return_path('chill_main_workflow_delete', {'id': entity_workflow.id}) }}"
|
||||||
></a>
|
>
|
||||||
|
{{ 'workflow.Delete workflow'|trans }}
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -23,10 +23,10 @@ class EntityWorkflowVoter extends Voter
|
|||||||
{
|
{
|
||||||
public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE';
|
public const CREATE = 'CHILL_MAIN_WORKFLOW_CREATE';
|
||||||
|
|
||||||
public const SEE = 'CHILL_MAIN_WORKFLOW_SEE';
|
|
||||||
|
|
||||||
public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE';
|
public const DELETE = 'CHILL_MAIN_WORKFLOW_DELETE';
|
||||||
|
|
||||||
|
public const SEE = 'CHILL_MAIN_WORKFLOW_SEE';
|
||||||
|
|
||||||
private EntityWorkflowManager $manager;
|
private EntityWorkflowManager $manager;
|
||||||
|
|
||||||
private Security $security;
|
private Security $security;
|
||||||
@ -44,6 +44,7 @@ class EntityWorkflowVoter extends Voter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EntityWorkflow $subject
|
* @param EntityWorkflow $subject
|
||||||
|
* @param mixed $attribute
|
||||||
*/
|
*/
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool
|
||||||
{
|
{
|
||||||
|
@ -399,6 +399,7 @@ workflow:
|
|||||||
Workflow deleted with success: Le workflow a été supprimé
|
Workflow deleted with success: Le workflow a été supprimé
|
||||||
Delete workflow ?: Supprimer le workflow ?
|
Delete workflow ?: Supprimer le workflow ?
|
||||||
Are you sure you want to delete this workflow ?: Êtes-vous sûr·e de vouloir supprimer ce workflow ?
|
Are you sure you want to delete this workflow ?: Êtes-vous sûr·e de vouloir supprimer ce workflow ?
|
||||||
|
Delete workflow: Supprimer le workflow
|
||||||
|
|
||||||
Subscribe final: Recevoir une notification à l'étape finale
|
Subscribe final: Recevoir une notification à l'étape finale
|
||||||
Subscribe all steps: Recevoir une notification à chaque étape
|
Subscribe all steps: Recevoir une notification à chaque étape
|
||||||
|
Loading…
x
Reference in New Issue
Block a user