mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
reactive my calendar on new route
This commit is contained in:
parent
f917be0958
commit
0f6dc3d997
@ -29,6 +29,7 @@ use Symfony\Component\Form\Form;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
@ -182,6 +183,27 @@ class CalendarController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my")
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function myCalendar(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_USER');
|
||||
|
||||
if (!$this->getUser() instanceof User) {
|
||||
throw new UnauthorizedHttpException('you are not an user');
|
||||
}
|
||||
|
||||
$view = '@ChillCalendar/Calendar/listByUser.html.twig';
|
||||
|
||||
return $this->render($view, [
|
||||
'user' => $this->getUser(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Calendar entities.
|
||||
*
|
||||
@ -193,6 +215,8 @@ class CalendarController extends AbstractController
|
||||
|
||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||
|
||||
/*
|
||||
dead code ?
|
||||
if ($user instanceof User) {
|
||||
$calendarItems = $this->calendarRepository->findByUser($user);
|
||||
|
||||
@ -203,6 +227,7 @@ class CalendarController extends AbstractController
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
*/
|
||||
|
||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||
$total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod);
|
||||
|
@ -58,7 +58,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
||||
|
||||
if ($this->authorizationChecker->isGranted('ROLE_USER')) {
|
||||
$menu->addChild('My calendar list', [
|
||||
'route' => 'chill_calendar_calendar_list',
|
||||
'route' => 'chill_calendar_calendar_list_my',
|
||||
])
|
||||
->setExtras([
|
||||
'order' => 9,
|
||||
|
Loading…
x
Reference in New Issue
Block a user