adding flash messages for customfield

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

View File

@ -27,9 +27,16 @@ class CustomFieldController extends Controller
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$this->addFlash('success', $this->get('translator')
->trans('The custom field has been created'));
return $this->redirect($this->generateUrl('customfield_show', array('id' => $entity->getId())));
}
return $this->redirect($this->generateUrl('customfieldsgroup_show',
array('id' => $entity->getCustomFieldsGroup()->getId())));
}
$this->addFlash('error', $this->get('translator')
->trans("The custom field form contains errors"));
return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array(
'entity' => $entity,
@ -166,9 +173,15 @@ class CustomFieldController extends Controller
if ($editForm->isValid()) {
$em->flush();
$this->addFlash('success', $this->get('translator')
->trans("The custom field has been updated"));
return $this->redirect($this->generateUrl('customfield_edit', array('id' => $id)));
}
$this->addFlash('error', $this->get('translator')
->trans("The custom field form contains errors"));
return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array(
'entity' => $entity,

View File

@ -37,6 +37,9 @@ Custom fields group: Groupe de champ personnalisé
Ordering: Ordre d'apparition
Back to the group: Retour au groupe de champs personnalisé
Slug: Identifiant textuel
The custom field has been created: Le champ personnalisé est créé
The custom field form contains errors: Le formulaire contient des erreurs
The custom field has been updated: Le champ personnalisé a été mis à jour
#custom field name
choice: choix