Permalink
Browse files

added flash messages to user Brick actions

  • Loading branch information...
inmarelibero committed Nov 6, 2012
1 parent fda974a commit c6f0212eae99a70f331160b9906edbc1edadf8ed
@@ -0,0 +1,18 @@
+####################################################################################################################
+# Translations #
+# #
+# alert messages translations #
+####################################################################################################################
+
+alert:
+ brick:
+ create:
+ success: Brick created successfully
+ error: Errors occurred while saving
+ update:
+ success: Changes were saved successfully
+ error: Errors occurred while saving
+ delete:
+ success: Brick deleted successfully
+ error: Errors occurred while deleting
+
@@ -0,0 +1,18 @@
+####################################################################################################################
+# Translations #
+# #
+# alert messages translations #
+####################################################################################################################
+
+alert:
+ brick:
+ create:
+ success: Brick creado con éxito
+ error: Se han producido errores
+ update:
+ success: Modificaciones guardadas con éxito
+ error: Se han producido errores
+ delete:
+ success: Brick eliminado con éxito
+ error: Se han producido errores
+
@@ -0,0 +1,18 @@
+####################################################################################################################
+# Translations #
+# #
+# alert messages translations #
+####################################################################################################################
+
+alert:
+ brick:
+ create:
+ success: Brick creato con successo
+ error: Si sono verificati degli errori durante il salvataggio
+ update:
+ success: Modifiche salvate con successo
+ error: Si sono verificati degli errori durante il salvataggio
+ delete:
+ success: Brick deleted successfully
+ error: Si sono verificati degli errori durante la cancellazione
+
@@ -76,9 +76,13 @@ public function createAction(Request $request)
$em->persist($entity);
$em->flush();
+
+ $this->get('session')->setFlash('success', 'alert.brick.create.success');
return $this->redirect($this->generateUrl('user_brick_edit', array('id' => $entity->getId())));
}
+
+ $this->get('session')->setFlash('error', 'alert.brick.create.error');
return array(
'entity' => $entity,
@@ -119,7 +123,7 @@ public function editAction($id)
*
* @Route("/{id}/update", name="user_brick_update")
* @Method("POST")
- * @Template("BricksSiteBundle:Brick:edit.html.twig")
+ * @Template("BricksUserBundle:Brick:edit.html.twig")
*/
public function updateAction(Request $request, $id)
{
@@ -141,9 +145,13 @@ public function updateAction(Request $request, $id)
if ($editForm->isValid()) {
$em->persist($entity);
$em->flush();
-
+
+ $this->get('session')->setFlash('success', 'alert.brick.update.success');
+
return $this->redirect($this->generateUrl('user_brick_edit', array('id' => $id)));
}
+
+ $this->get('session')->setFlash('error', 'alert.brick.update.error');
return array(
'entity' => $entity,
@@ -193,6 +201,10 @@ public function deleteAction(Request $request, $id)
$em->remove($entity);
$em->flush();
+
+ $this->get('session')->setFlash('success', 'alert.brick.delete.success');
+ } else {
+ $this->get('session')->setFlash('error', 'alert.brick.delete.error');
}
return $this->redirect($this->generateUrl('user_brick'));

0 comments on commit c6f0212

Please sign in to comment.