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

View File

@ -46,7 +46,7 @@ class Calendar
* @Groups({"read"}) * @Groups({"read"})
* @Serializer\Groups({"calendar:read"}) * @Serializer\Groups({"calendar:read"})
*/ */
private User $user; private ?User $user = null;
/** /**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod") * @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
@ -101,20 +101,20 @@ class Calendar
* @ORM\Column(type="datetimetz_immutable") * @ORM\Column(type="datetimetz_immutable")
* @Serializer\Groups({"calendar:read"}) * @Serializer\Groups({"calendar:read"})
*/ */
private \DateTimeImmutable $startDate; private ?\DateTimeImmutable $startDate = null;
/** /**
* @ORM\Column(type="datetimetz_immutable") * @ORM\Column(type="datetimetz_immutable")
* @Serializer\Groups({"calendar:read"}) * @Serializer\Groups({"calendar:read"})
*/ */
private \DateTimeImmutable $endDate; private ?\DateTimeImmutable $endDate = null;
//TODO Lieu //TODO Lieu
/** /**
* @ORM\Column(type="string", length=255) * @ORM\Column(type="string", length=255)
*/ */
private string $status; private ?string $status = null;
/** /**
* @ORM\ManyToOne(targetEntity="CancelReason") * @ORM\ManyToOne(targetEntity="CancelReason")
@ -129,7 +129,7 @@ class Calendar
/** /**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity") * @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\Activity")
*/ */
private Activity $activity; private ?Activity $activity = null;
/** /**
* @ORM\Column(type="boolean", nullable=true) * @ORM\Column(type="boolean", nullable=true)

View File

@ -27,19 +27,19 @@ class CalendarRange
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User") * @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @groups({"read", "write"}) * @groups({"read", "write"})
*/ */
private User $user; private ?User $user = null;
/** /**
* @ORM\Column(type="datetimetz_immutable") * @ORM\Column(type="datetimetz_immutable")
* @groups({"read", "write"}) * @groups({"read", "write"})
*/ */
private \DateTimeImmutable $startDate; private ?\DateTimeImmutable $startDate = null;
/** /**
* @ORM\Column(type="datetimetz_immutable") * @ORM\Column(type="datetimetz_immutable")
* @groups({"read", "write"}) * @groups({"read", "write"})
*/ */
private \DateTimeImmutable $endDate; private ?\DateTimeImmutable $endDate = null;
/** /**
* @ORM\OneToMany(targetEntity=Calendar::class, * @ORM\OneToMany(targetEntity=Calendar::class,

View File

@ -37,7 +37,7 @@ class AccompanyingCourseMenuBuilder implements LocalMenuBuilderInterface
if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) { if (AccompanyingPeriod::STEP_DRAFT !== $period->getStep()) {
$menu->addChild($this->translator->trans('Calendar'), [ $menu->addChild($this->translator->trans('Calendar'), [
'route' => 'chill_calendar_calendar', 'route' => 'chill_calendar_calendar_list',
'routeParameters' => [ 'routeParameters' => [
'accompanying_period_id' => $period->getId(), 'accompanying_period_id' => $period->getId(),
]]) ]])

View File

@ -211,13 +211,13 @@ export default {
this.modal.showModal = true; this.modal.showModal = true;
}, },
myCalendarEventShowLink() { myCalendarEventShowLink() {
return `/fr/calendar/ ${this.myCalendarClickedEvent.id}/show?user_id=${ this.userId }` return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/show?user_id=${ this.userId }`
}, },
myCalendarEventUpdateLink() { myCalendarEventUpdateLink() {
return `/fr/calendar/ ${this.myCalendarClickedEvent.id}/edit?user_id=${ this.userId }` return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/edit?user_id=${ this.userId }`
}, },
myCalendarEventDeleteLink() { myCalendarEventDeleteLink() {
return `/fr/calendar/ ${this.myCalendarClickedEvent.id}/delete?user_id=${ this.userId }` return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/delete?user_id=${ this.userId }`
}, },
resetCalendar() { resetCalendar() {
this.fetchData(); this.fetchData();

View File

@ -1,6 +1,6 @@
{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %} {% extends "@ChillPerson/AccompanyingCourse/layout.html.twig" %}
{% set activeRouteKey = 'chill_calendar_calendar' %} {% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'Remove calendar item'|trans %} {% block title 'Remove calendar item'|trans %}
@ -9,8 +9,8 @@
{ {
'title' : 'Remove calendar item'|trans, 'title' : 'Remove calendar item'|trans,
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans, 'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
'cancel_route' : 'chill_calendar_calendar', 'cancel_route' : 'chill_calendar_calendar_list',
'cancel_parameters' : { 'accompanying_course_id' : accompanyingCourse.id, 'id' : calendar.id }, 'cancel_parameters' : { 'accompanying_period_id' : accompanyingCourse.id, 'id' : calendar.id },
'form' : delete_form 'form' : delete_form
} ) }} } ) }}
{% endblock %} {% endblock %}

View File

@ -2,7 +2,7 @@
{% set user = calendar.user %} {% set user = calendar.user %}
{% set activeRouteKey = 'chill_calendar_calendar' %} {% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'Remove activity'|trans %} {% block title 'Remove activity'|trans %}
@ -11,7 +11,7 @@
{ {
'title' : 'Remove calendar item'|trans, 'title' : 'Remove calendar item'|trans,
'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans, 'confirm_question' : 'Are you sure you want to remove the calendar item?'|trans,
'cancel_route' : 'chill_calendar_calendar', 'cancel_route' : 'chill_calendar_calendar_list',
'cancel_parameters' : { 'user_id' : calendar.user.id, 'id' : calendar.id }, 'cancel_parameters' : { 'user_id' : calendar.user.id, 'id' : calendar.id },
'form' : delete_form 'form' : delete_form
} ) }} } ) }}

View File

@ -59,9 +59,9 @@
<a <a
class="btn btn-cancel" class="btn btn-cancel"
{%- if context == 'user' -%} {%- if context == 'user' -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'user_id': user.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'user_id': user.id } )}}"
{%- elseif context == 'accompanyingCourse' -%} {%- elseif context == 'accompanyingCourse' -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
{%- endif -%} {%- endif -%}
> >
{{ 'Cancel'|trans|chill_return_path_label }} {{ 'Cancel'|trans|chill_return_path_label }}

View File

@ -51,9 +51,9 @@
<a <a
class="btn btn-cancel" class="btn btn-cancel"
{%- if context == 'person' -%} {%- if context == 'person' -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'person_id': person.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'person_id': person.id } )}}"
{%- else -%} {%- else -%}
href="{{ chill_return_path_or('chill_calendar_calendar', { 'accompanying_period_id': accompanyingCourse.id } )}}" href="{{ chill_return_path_or('chill_calendar_calendar_list', { 'accompanying_period_id': accompanyingCourse.id } )}}"
{%- endif -%} {%- endif -%}
> >
{{ 'Cancel'|trans|chill_return_path_label }} {{ 'Cancel'|trans|chill_return_path_label }}

View File

@ -65,7 +65,7 @@
<ul class="record_actions sticky-form-buttons"> <ul class="record_actions sticky-form-buttons">
<li class="cancel"> <li class="cancel">
<a class="btn btn-cancel" href="{{ path('chill_calendar_calendar', { 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}"> <a class="btn btn-cancel" href="{{ path('chill_calendar_calendar_list', { 'accompanying_period_id': accompanying_course_id, 'user_id': user_id } ) }}">
{{ 'Back to the list'|trans }} {{ 'Back to the list'|trans }}
</a> </a>
</li> </li>

View File

@ -116,7 +116,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
]); ]);
$menu->addChild("My calendar list", [ $menu->addChild("My calendar list", [
'route' => 'chill_calendar_calendar', 'route' => 'chill_calendar_calendar_list',
'routeParameters' => [ 'routeParameters' => [
'user_id' => $user->getId(), 'user_id' => $user->getId(),
] ]