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
3fb3df9db1
commit
aecdfa6b12
@ -29,6 +29,7 @@ use Symfony\Component\Form\Form;
|
|||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
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.
|
* Lists all Calendar entities.
|
||||||
*
|
*
|
||||||
@ -193,6 +215,8 @@ class CalendarController extends AbstractController
|
|||||||
|
|
||||||
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
[$user, $accompanyingPeriod] = $this->getEntity($request);
|
||||||
|
|
||||||
|
/*
|
||||||
|
dead code ?
|
||||||
if ($user instanceof User) {
|
if ($user instanceof User) {
|
||||||
$calendarItems = $this->calendarRepository->findByUser($user);
|
$calendarItems = $this->calendarRepository->findByUser($user);
|
||||||
|
|
||||||
@ -203,6 +227,7 @@ class CalendarController extends AbstractController
|
|||||||
'user' => $user,
|
'user' => $user,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
if ($accompanyingPeriod instanceof AccompanyingPeriod) {
|
||||||
$total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod);
|
$total = $this->calendarRepository->countByAccompanyingPeriod($accompanyingPeriod);
|
||||||
|
@ -58,7 +58,7 @@ class UserMenuBuilder implements LocalMenuBuilderInterface
|
|||||||
|
|
||||||
if ($this->authorizationChecker->isGranted('ROLE_USER')) {
|
if ($this->authorizationChecker->isGranted('ROLE_USER')) {
|
||||||
$menu->addChild('My calendar list', [
|
$menu->addChild('My calendar list', [
|
||||||
'route' => 'chill_calendar_calendar_list',
|
'route' => 'chill_calendar_calendar_list_my',
|
||||||
])
|
])
|
||||||
->setExtras([
|
->setExtras([
|
||||||
'order' => 9,
|
'order' => 9,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user