From a58ae088ffb66a7d8a30834902b07d30edba86a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 25 Apr 2018 12:18:44 +0200 Subject: [PATCH] fix error in return path and fix date interval conversion --- Controller/SingleTaskController.php | 24 +++++++++++------------ Resources/views/SingleTask/show.html.twig | 6 +++--- Resources/views/Task/index.html.twig | 4 ++-- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index 7cc2f3bb0..4959cd97f 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -18,8 +18,6 @@ use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\TaskBundle\Repository\SingleTaskRepository; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Security\Authorization\PersonVoter; -use Chill\TaskBundle\Repository\SingleTaskRepository; -use Chill\MainBundle\Pagination\PaginatorFactory; class SingleTaskController extends Controller { @@ -52,8 +50,8 @@ class SingleTaskController extends Controller ->setType('task_default') ; - // $this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not ' - // . 'allowed to create this task'); + $this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not ' + . 'allowed to create this task'); $form = $this->setCreateForm($task, new Role(TaskVoter::CREATE)); @@ -68,7 +66,7 @@ class SingleTaskController extends Controller $this->addFlash('success', "The task is created"); - return $this->redirectToRoute('chill_task_task_list', [ + return $this->redirectToRoute('chill_task_task_list_by_person', [ 'personId' => $task->getPerson()->getId() ]); @@ -112,8 +110,8 @@ class SingleTaskController extends Controller throw $this->createNotFoundException("Invalid person id"); } } - // $this->denyAccessUnlessGranted(TaskVoter::SEE, $task, 'You are not ' - // . 'allowed to view this task'); + $this->denyAccessUnlessGranted(TaskVoter::SHOW, $task, 'You are not ' + . 'allowed to view this task'); if (!$task) { throw $this->createNotFoundException('Unable to find Task entity.'); @@ -152,8 +150,8 @@ class SingleTaskController extends Controller throw $this->createNotFoundException("Invalid person id"); } } - // $this->denyAccessUnlessGranted(TaskVoter::UPDATE, $task, 'You are not ' - // . 'allowed to edit this task'); + $this->denyAccessUnlessGranted(TaskVoter::UPDATE, $task, 'You are not ' + . 'allowed to edit this task'); if (!$task) { throw $this->createNotFoundException('Unable to find Task entity.'); @@ -172,7 +170,7 @@ class SingleTaskController extends Controller $this->addFlash('success', "Success : task updated!"); - return $this->redirectToRoute('chill_task_task_list', [ + return $this->redirectToRoute('chill_task_task_list_by_person', [ 'personId' => $task->getPerson()->getId() ]); @@ -218,8 +216,8 @@ class SingleTaskController extends Controller } - // $this->denyAccessUnlessGranted(TaskVoter::DELETE, $task, 'You are not ' - // . 'allowed to delete this task'); + $this->denyAccessUnlessGranted(TaskVoter::DELETE, $task, 'You are not ' + . 'allowed to delete this task'); if (!$task) { throw $this->createNotFoundException('Unable to find Task entity.'); @@ -252,7 +250,7 @@ class SingleTaskController extends Controller ->trans("The task has been successfully removed.")); return $this->redirect($this->generateUrl( - 'chill_task_task_list', array( + 'chill_task_task_list_by_person', array( 'personId' => $personId ))); } diff --git a/Resources/views/SingleTask/show.html.twig b/Resources/views/SingleTask/show.html.twig index 6e073772a..0c0389c78 100644 --- a/Resources/views/SingleTask/show.html.twig +++ b/Resources/views/SingleTask/show.html.twig @@ -44,13 +44,13 @@
{{ 'End date'|trans }}
{{ task.endDate|localizeddate('long', 'none') }}
-
{{ 'Warning interval'|trans }}
-
{{ task.warningInterval|localizeddate('long', 'none') }}
+
{{ 'Warning date'|trans }}
+
{{ task.warningDate|localizeddate('long', 'none') }}