mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
allow to edit notification
This commit is contained in:
@@ -120,6 +120,36 @@ class NotificationController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{id}/edit", name="chill_main_notification_edit")
|
||||
*/
|
||||
public function editAction(Notification $notification, Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted(NotificationVoter::UPDATE, $notification);
|
||||
|
||||
$form = $this->createForm(NotificationType::class, $notification);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->em->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator->trans('notification.Notification updated'));
|
||||
|
||||
if ($request->query->has('returnPath')) {
|
||||
return new RedirectResponse($request->query->get('returnPath'));
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('chill_main_notification_my');
|
||||
}
|
||||
|
||||
return $this->render('@ChillMain/Notification/edit.html.twig', [
|
||||
'form' => $form->createView(),
|
||||
'handler' => $this->notificationHandlerManager->getHandler($notification),
|
||||
'notification' => $notification,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/inbox", name="chill_main_notification_my")
|
||||
*/
|
||||
|
Reference in New Issue
Block a user