diff --git a/changelog.md b/changelog.md index 30f0304..50114c7 100644 --- a/changelog.md +++ b/changelog.md @@ -64,4 +64,5 @@ ### Next #### Improve -- Move columns in activity table \ No newline at end of file +- Move columns in activity table +- Reditect to activity after creating one \ No newline at end of file diff --git a/src/Controller/ActivityController.php b/src/Controller/ActivityController.php index 9dcf489..3b4803a 100644 --- a/src/Controller/ActivityController.php +++ b/src/Controller/ActivityController.php @@ -11,6 +11,7 @@ use App\Form\Activity\ActivityDeleteForm; use App\Form\Activity\ActivityEditForm; use App\Form\Activity\ActivityFilterForm; +use Symfony\Component\Routing\Generator\UrlGenerator; /** * Controller for activity related pages @@ -49,8 +50,9 @@ $entityManager->persist($activity); $entityManager->flush(); return $this->ajaxFormAnswer([ - 'refresh' => true, - 'reset' => true, + 'redirect' => $this->generateUrl('activity_activity', [ + 'id' => $activity->getId() + ], UrlGenerator::ABSOLUTE_PATH), ]); } else { return $this->ajaxFormAnswer([ diff --git a/templates/_includes/html/form/activity/add.html.twig b/templates/_includes/html/form/activity/add.html.twig index e160425..483635d 100644 --- a/templates/_includes/html/form/activity/add.html.twig +++ b/templates/_includes/html/form/activity/add.html.twig @@ -15,7 +15,6 @@ {{ form_label(form.actor, 'Acteur', {label_attr: {class: 'input-text-label'}}) }} {{ form_widget(form.actor, {attr: {class: 'w-100'}}) }} -