From 48174c8998f18e31a2d77a2da7c594f92e730e1c Mon Sep 17 00:00:00 2001 From: thisfro Date: Fri, 30 Apr 2021 17:21:15 +0200 Subject: [PATCH] Flash a notification when offering added --- src/Controller/AppController.php | 3 +++ templates/app/index.html.twig | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/Controller/AppController.php b/src/Controller/AppController.php index 55670d4..30cf2ac 100644 --- a/src/Controller/AppController.php +++ b/src/Controller/AppController.php @@ -53,6 +53,9 @@ class AppController extends AbstractController $this->entityManager->persist($offering); $this->entityManager->flush(); + + $this->addFlash("success", "Successfully added the new offering!"); + return $this->redirectToRoute('homepage'); } return $this->render('app/new_listing.html.twig', [ diff --git a/templates/app/index.html.twig b/templates/app/index.html.twig index bce6b12..881c486 100644 --- a/templates/app/index.html.twig +++ b/templates/app/index.html.twig @@ -2,6 +2,12 @@ {% block body %} + {% for message in app.flashes('success') %} + + {% endfor %} +

Offerings

{% if offerings|length > 0 %}