diff --git a/Controller/ActivityController.php b/Controller/ActivityController.php index 21a61cd01..21e87264e 100644 --- a/Controller/ActivityController.php +++ b/Controller/ActivityController.php @@ -80,11 +80,24 @@ class ActivityController extends Controller $em->persist($entity); $em->flush(); + + $this->get('session') + ->getFlashBag() + ->add('success', + $this->get('translator') + ->trans('Success : activity created!') + ); return $this->redirect( $this->generateUrl('chill_activity_activity_show', 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( 'entity' => $entity, @@ -113,8 +126,6 @@ class ActivityController extends Controller ) ); - $form->add('submit', 'submit', array('label' => 'Create')); - return $form; } @@ -233,8 +244,6 @@ class ActivityController extends Controller 'role' => new Role('CHILL_ACTIVITY_UPDATE') )); - $form->add('submit', 'submit', array('label' => 'Update')); - return $form; } /** @@ -260,9 +269,23 @@ class ActivityController extends Controller if ($editForm->isValid()) { $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( 'entity' => $entity, diff --git a/Form/ActivityType.php b/Form/ActivityType.php index bf8fc492d..b6c52fb4a 100644 --- a/Form/ActivityType.php +++ b/Form/ActivityType.php @@ -67,7 +67,10 @@ class ActivityType extends AbstractType 'widget' => 'single_text', 'format' => 'dd-MM-yyyy') ) - ->add('durationTime', 'time') + ->add('durationTime', 'time', array( + 'widget' => 'text', + 'hours' => array(0, 1, 2, 3, 4, 5, 6, 7, 8) + )) ->add('remark', 'textarea', array( 'required' => false, 'empty_data' => '' diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index 574b12017..82172eca1 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -14,13 +14,21 @@ not present: absent Delete: Supprimer Update: Mettre à jour Update activity: Édition de l'activité +Scope: Cercle #forms Activity creation: Nouvelle activité Create: Créer Back to the list: Retour à la liste +Save activity: Sauver l'activité +Reset form: Remise à zéro du formulaire #timeline '%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. diff --git a/Resources/views/Activity/edit.html.twig b/Resources/views/Activity/edit.html.twig index 5b96d5f4b..d92ecab39 100644 --- a/Resources/views/Activity/edit.html.twig +++ b/Resources/views/Activity/edit.html.twig @@ -23,7 +23,20 @@ {% block personcontent %}
{{ entity.remark }}{% endif %}