add flash message for custom fields group

This commit is contained in:
Julien Fastré 2015-11-27 14:26:46 +01:00
parent 46173231d2
commit 2401270754
2 changed files with 19 additions and 0 deletions

View File

@ -97,9 +97,15 @@ class CustomFieldsGroupController extends Controller
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$em->persist($entity); $em->persist($entity);
$em->flush(); $em->flush();
$this->addFlash('success', $this->get('translator')
->trans("The custom fields group has been created"));
return $this->redirect($this->generateUrl('customfieldsgroup_show', array('id' => $entity->getId()))); return $this->redirect($this->generateUrl('customfieldsgroup_show', array('id' => $entity->getId())));
} }
$this->addFlash('error', $this->get('translator')
->trans("The custom fields group form contains errors"));
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array( return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array(
'entity' => $entity, 'entity' => $entity,
@ -274,9 +280,15 @@ class CustomFieldsGroupController extends Controller
if ($editForm->isValid()) { if ($editForm->isValid()) {
$em->flush(); $em->flush();
$this->addFlash('success', $this->get('translator')
->trans("The custom fields group has been updated"));
return $this->redirect($this->generateUrl('customfieldsgroup_edit', array('id' => $id))); return $this->redirect($this->generateUrl('customfieldsgroup_edit', array('id' => $id)));
} }
$this->addFlash('error', $this->get('translator')
->trans("The custom fields group form contains errors"));
return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array( return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array(
'entity' => $entity, 'entity' => $entity,
@ -324,6 +336,9 @@ class CustomFieldsGroupController extends Controller
$em->persist($newCFDefaultGroup); $em->persist($newCFDefaultGroup);
$em->flush(); $em->flush();
$this->addFlash('success', $this->get('translator')
->trans("The default custom fields group has been changed"));
return $this->redirect($this->generateUrl('customfieldsgroup')); return $this->redirect($this->generateUrl('customfieldsgroup'));
} }

View File

@ -21,6 +21,10 @@ active: actif
No value defined for this option: Pas de valeur pour cette option No value defined for this option: Pas de valeur pour cette option
CustomFieldsGroup edit: Edition d'un groupe de champs personnalisé CustomFieldsGroup edit: Edition d'un groupe de champs personnalisé
type: type type: type
The custom fields group has been created: Le groupe de champs personnalisés a été créé
The custom fields group has been updated: Le groupe de champs personnalisés a été mis à jour
The custom fields group form contains errors: Le formulaire contient des erreurs
The default custom fields group has been changed: Le groupe par défaut a été changé
#menu entries #menu entries