mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add flashbag message for activity
This commit is contained in:
parent
e0561340a5
commit
e36c195ecf
@ -80,11 +80,24 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
$this->get('session')
|
||||||
|
->getFlashBag()
|
||||||
|
->add('success',
|
||||||
|
$this->get('translator')
|
||||||
|
->trans('Success : activity created!')
|
||||||
|
);
|
||||||
|
|
||||||
return $this->redirect(
|
return $this->redirect(
|
||||||
$this->generateUrl('chill_activity_activity_show',
|
$this->generateUrl('chill_activity_activity_show',
|
||||||
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
array('id' => $entity->getId(), 'person_id' => $person_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->get('session')
|
||||||
|
->getFlashBag()->add('danger',
|
||||||
|
$this->get('translator')
|
||||||
|
->trans('The form is not valid. The activity has not been created !')
|
||||||
|
);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:new.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
@ -231,8 +244,6 @@ class ActivityController extends Controller
|
|||||||
'role' => new Role('CHILL_ACTIVITY_UPDATE')
|
'role' => new Role('CHILL_ACTIVITY_UPDATE')
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->add('submit', 'submit', array('label' => 'Update'));
|
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -258,9 +269,23 @@ class ActivityController extends Controller
|
|||||||
|
|
||||||
if ($editForm->isValid()) {
|
if ($editForm->isValid()) {
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
$this->get('session')
|
||||||
|
->getFlashBag()
|
||||||
|
->add('success',
|
||||||
|
$this->get('translator')
|
||||||
|
->trans('Success : activity updated!')
|
||||||
|
);
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_activity_activity_edit', array('id' => $id, 'person_id' => $person_id)));
|
return $this->redirect($this->generateUrl('chill_activity_activity_show', array('id' => $id, 'person_id' => $person_id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->get('session')
|
||||||
|
->getFlashBag()
|
||||||
|
->add('danger',
|
||||||
|
$this->get('translator')
|
||||||
|
->trans('The form is not valid. The activity has not been updated !')
|
||||||
|
);
|
||||||
|
|
||||||
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
return $this->render('ChillActivityBundle:Activity:edit.html.twig', array(
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
|
@ -26,4 +26,9 @@ Reset form: Remise à zéro du formulaire
|
|||||||
#timeline
|
#timeline
|
||||||
'%user% has done an %activity_type% on %date%': %user% a effectué une activité de type "%activity_type%" le %date%
|
'%user% has done an %activity_type% on %date%': %user% a effectué une activité de type "%activity_type%" le %date%
|
||||||
|
|
||||||
|
#controller
|
||||||
|
'Success : activity created!': Bravo ! L'activité a été créée.
|
||||||
|
'The form is not valid. The activity has not been created !': Le formulaire est invalide. L'activité n'a pas été créée.
|
||||||
|
'Success : activity updated!': Bravo ! L'activité a été mise à jour.
|
||||||
|
'The form is not valid. The activity has not been updated !': Le formulaire est invalide. L'activité n'a pas été mise à jour.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user