rdv MR review: change name of routes + others modifications

This commit is contained in:
nobohan
2021-09-13 11:58:48 +02:00
parent 503c97d8c6
commit c82efc4fd5
11 changed files with 40 additions and 40 deletions

View File

@@ -69,7 +69,7 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities.
* @Route("/{_locale}/calendar/", name="chill_calendar_calendar")
* @Route("/{_locale}/calendar/calendar/", name="chill_calendar_calendar_list")
*/
public function listAction(Request $request): Response
{
@@ -83,14 +83,14 @@ class CalendarController extends AbstractController
$calendarItems = $em->getRepository(Calendar::class)
->findByUser($user)
;
$view = 'ChillCalendarBundle:Calendar:listByUser.html.twig';
$view = '@ChillCalendar/Calendar/listByUser.html.twig';
} elseif ($accompanyingPeriod instanceof AccompanyingPeriod) {
$calendarItems = $em->getRepository(Calendar::class)->findBy(
['accompanyingPeriod' => $accompanyingPeriod],
['startDate' => 'DESC']
);
$view = 'ChillCalendarBundle:Calendar:listByAccompanyingCourse.html.twig';
$view = '@ChillCalendar/Calendar/listByAccompanyingCourse.html.twig';
}
return $this->render($view, [
@@ -102,7 +102,7 @@ class CalendarController extends AbstractController
/**
* Create a new calendar item
* @Route("/{_locale}/calendar/new", name="chill_calendar_calendar_new")
* @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new")
*/
public function newAction(Request $request): Response
{
@@ -111,10 +111,10 @@ class CalendarController extends AbstractController
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillCalendarBundle:Calendar:newAccompanyingCourse.html.twig';
$view = '@ChillCalendar/Calendar/newAccompanyingCourse.html.twig';
}
// elseif ($user instanceof User) {
// $view = 'ChillCalendarBundle:Calendar:newUser.html.twig';
// $view = '@ChillCalendar/Calendar/newUser.html.twig';
// }
$entity = new Calendar();
@@ -141,7 +141,7 @@ class CalendarController extends AbstractController
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar', $params);
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
@@ -164,7 +164,7 @@ class CalendarController extends AbstractController
/**
* Show a calendar item
* @Route("/{_locale}/calendar/{id}/show", name="chill_calendar_calendar_show")
* @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show")
*/
public function showAction(Request $request, $id): Response
{
@@ -173,10 +173,10 @@ class CalendarController extends AbstractController
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillCalendarBundle:Calendar:showByAccompanyingCourse.html.twig';
$view = '@ChillCalendar/Calendar/showByAccompanyingCourse.html.twig';
}
elseif ($user instanceof User) {
$view = 'ChillCalendarBundle:Calendar:showByUser.html.twig';
$view = '@ChillCalendar/Calendar/showByUser.html.twig';
}
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
@@ -208,7 +208,7 @@ class CalendarController extends AbstractController
/**
* Edit a calendar item
* @Route("/{_locale}/calendar/{id}/edit", name="chill_calendar_calendar_edit")
* @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit")
*/
public function editAction($id, Request $request): Response
{
@@ -217,10 +217,10 @@ class CalendarController extends AbstractController
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillCalendarBundle:Calendar:editByAccompanyingCourse.html.twig';
$view = '@ChillCalendar/Calendar/editByAccompanyingCourse.html.twig';
}
elseif ($user instanceof User) {
$view = 'ChillCalendarBundle:Calendar:editByUser.html.twig';
$view = '@ChillCalendar/Calendar/editByUser.html.twig';
}
$entity = $em->getRepository('ChillCalendarBundle:Calendar')->find($id);
@@ -240,7 +240,7 @@ class CalendarController extends AbstractController
$this->addFlash('success', $this->get('translator')->trans('Success : calendar item updated!'));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar', $params);
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
} elseif ($form->isSubmitted() and !$form->isValid()) {
$this->addFlash('error', $this->get('translator')->trans('This form contains errors'));
}
@@ -274,10 +274,10 @@ class CalendarController extends AbstractController
[$user, $accompanyingPeriod] = $this->getEntity($request);
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByAccompanyingCourse.html.twig';
$view = '@ChillCalendar/Calendar/confirm_deleteByAccompanyingCourse.html.twig';
}
elseif ($user instanceof User) {
$view = 'ChillCalendarBundle:Calendar:confirm_deleteByUser.html.twig';
$view = '@ChillCalendar/Calendar/confirm_deleteByUser.html.twig';
}
/* @var $entity Calendar */
@@ -306,7 +306,7 @@ class CalendarController extends AbstractController
->trans("The calendar item has been successfully removed."));
$params = $this->buildParamsToUrl($user, $accompanyingPeriod);
return $this->redirectToRoute('chill_calendar_calendar', $params);
return $this->redirectToRoute('chill_calendar_calendar_list', $params);
}
}