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);
}
}

View File

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

View File

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

View File

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

View File

@ -211,13 +211,13 @@ export default {
this.modal.showModal = true;
},
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() {
return `/fr/calendar/ ${this.myCalendarClickedEvent.id}/edit?user_id=${ this.userId }`
return `/fr/calendar/calendar/${this.myCalendarClickedEvent.id}/edit?user_id=${ this.userId }`
},
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() {
this.fetchData();

View File

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

View File

@ -2,7 +2,7 @@
{% set user = calendar.user %}
{% set activeRouteKey = 'chill_calendar_calendar' %}
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
{% block title 'Remove activity'|trans %}
@ -11,7 +11,7 @@
{
'title' : 'Remove 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 },
'form' : delete_form
} ) }}

View File

@ -59,9 +59,9 @@
<a
class="btn btn-cancel"
{%- 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' -%}
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 -%}
>
{{ 'Cancel'|trans|chill_return_path_label }}

View File

@ -51,9 +51,9 @@
<a
class="btn btn-cancel"
{%- 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 -%}
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 -%}
>
{{ 'Cancel'|trans|chill_return_path_label }}

View File

@ -65,7 +65,7 @@
<ul class="record_actions sticky-form-buttons">
<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 }}
</a>
</li>

View File

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