diff --git a/sources/AppBundle/Controller/Event/CFP/EditAction.php b/sources/AppBundle/Controller/Event/CFP/EditAction.php index e25d6e7fa..c7cd5df2c 100644 --- a/sources/AppBundle/Controller/Event/CFP/EditAction.php +++ b/sources/AppBundle/Controller/Event/CFP/EditAction.php @@ -22,7 +22,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Contracts\Translation\TranslatorInterface; @@ -44,11 +46,11 @@ public function __construct( private readonly Authentication $authentication, ) {} - public function __invoke(Request $request) + public function __invoke(Request $request): RedirectResponse|Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); $githubUser = $this->authentication->getGithubUser(); - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', ['event' => $event]); } $speaker = $this->speakerFactory->getSpeaker($event); diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index 6411d376f..fd8cba5e3 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -9,7 +9,6 @@ use AppBundle\Event\Form\TalkType; use AppBundle\Event\Model\Talk; use AppBundle\Event\Talk\TalkFormHandler; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -29,7 +28,7 @@ public function __construct( public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); @@ -48,11 +47,7 @@ public function __invoke(Request $request): Response $form = $this->createForm(TalkType::class, $talk, [ TalkType::IS_AFUP_DAY => $event->isAfupDay(), ]); - if ($event->isCfpOpen()) { - $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); - } else { - $form->add('save', SubmitType::class, ['label' => 'CFP fermé', 'attr' => ['disabled' => 'disabled']]); - } + $form->add('save', SubmitType::class, ['label' => 'Sauvegarder']); if ($this->talkFormHandler->handle($request, $event, $form, $speaker)) { $this->addFlash('success', $this->translator->trans('Proposition enregistrée !')); diff --git a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php index 4916c6753..89fbb1478 100644 --- a/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php +++ b/sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php @@ -7,7 +7,6 @@ use AppBundle\CFP\SpeakerFactory; use AppBundle\Event\Model\Event; use AppBundle\Event\Model\Repository\TalkRepository; -use DateTime; use Twig\Environment; class SidebarRenderer @@ -18,12 +17,9 @@ public function __construct( private readonly Environment $twig, ) {} - /** - * @return string - */ - public function render(Event $event) + public function render(Event $event): string { - if ($event->getDateEndCallForPapers() < new DateTime()) { + if (!$event->isCfpOpen()) { return ''; } diff --git a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php index 2c7216aa6..f49d2398a 100644 --- a/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php +++ b/sources/AppBundle/Controller/Event/CFP/SpeakerAction.php @@ -9,7 +9,6 @@ use AppBundle\Controller\Event\EventActionHelper; use AppBundle\Event\Form\SpeakerType; use AppBundle\Event\Model\Repository\SpeakerRepository; -use DateTime; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; @@ -32,13 +31,13 @@ public function __invoke(Request $request): Response { $event = $this->eventActionHelper->getEvent($request->attributes->get('eventSlug')); - $speaker = $this->speakerFactory->getSpeaker($event); - if ($event->getDateEndCallForPapers() < new DateTime() && $speaker->getId() === null) { + if (!$event->isCfpOpen()) { return $this->render('event/cfp/closed.html.twig', [ 'event' => $event, ]); } + $speaker = $this->speakerFactory->getSpeaker($event); $form = $this->createForm(SpeakerType::class, $speaker, [ SpeakerType::OPT_PHOTO_REQUIRED => null === $speaker->getPhoto(), ]); diff --git a/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php b/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php index 79dc764d4..c8b3cf78d 100644 --- a/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php +++ b/sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php @@ -28,13 +28,10 @@ public function __invoke(Request $request, string $eventSlug): Response { $event = $this->eventActionHelper->getEvent($eventSlug); - if ($event->getDateEndCallForPapers() < new \DateTime()) { - return $this->render( - 'event/speaker-suggestion/closed.html.twig', - [ - 'event' => $event, - ], - ); + if (!$event->isCfpOpen()) { + return $this->render('event/cfp/closed.html.twig', [ + 'event' => $event, + ]); } $form = $this->createForm(SpeakerSuggestionType::class); diff --git a/templates/event/cfp/closed.html.twig b/templates/event/cfp/closed.html.twig index 684e5113c..8f0e78c43 100644 --- a/templates/event/cfp/closed.html.twig +++ b/templates/event/cfp/closed.html.twig @@ -1,11 +1,12 @@ {% extends 'event/cfp/base.html.twig' %} {% block content %} -
{{ 'Désolé ! Le CFP est terminé pour cet évènement !' }}
-{{ 'L\'accès est réservés à celles et ceux ayant déjà proposé des conférences.' }}
- - {{ 'Accès à mes conférences'|trans }} - - +Désolé ... le CFP est fermé pour cet évènement !
+ + Accès à mes conférences + + +{{ 'Vous n\'avez pas encore rempli votre profil conférencier.'|trans }}
{% else %} diff --git a/templates/event/speaker-suggestion/closed.html.twig b/templates/event/speaker-suggestion/closed.html.twig deleted file mode 100644 index 321591f21..000000000 --- a/templates/event/speaker-suggestion/closed.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{% extends 'event/base.html.twig' %} - -{% block content %} -