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 %} -

CFP: {{ event.title }}

-

{{ '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 }} - - +
+

CFP: {{ event.title }}

+

Désolé ... le CFP est fermé pour cet évènement !

+ + Accès à mes conférences + + +
{% endblock %} diff --git a/templates/event/cfp/home.html.twig b/templates/event/cfp/home.html.twig index 8b497ddee..2c2ad8fb6 100644 --- a/templates/event/cfp/home.html.twig +++ b/templates/event/cfp/home.html.twig @@ -5,7 +5,9 @@

CFP: {{ event.title }}

{{ 'Mon espace conférencier'|trans }}

+ {% if event.cfpOpen %}

Modifier

+ {% endif %} {% if speaker.id == 0 %}

{{ '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 %} -
-

Suggérer un·e conférencier·e

- - Les suggestions pour le {{ event.title }} sont fermées. -
- -{% endblock %} diff --git a/tests/behat/features/EventPages/Cfp.feature b/tests/behat/features/EventPages/Cfp.feature index 335c8eb8d..5d2412c4e 100644 --- a/tests/behat/features/EventPages/Cfp.feature +++ b/tests/behat/features/EventPages/Cfp.feature @@ -80,18 +80,28 @@ Feature: Event pages - CFP Then I should see "Oauth login test" When I follow "Connect as userGithub1" Then I should see "Mon espace conférencier" - When I follow "Mon profil conférencier" - # Création du profile - Then The "speaker[civility]" field should only contain the follow values '["M", "Mme"]' - When I fill in "speaker[firstname]" with "Mon prénom" - And I fill in "speaker[lastname]" with "Mon prénom" - And I fill in "speaker[email]" with "monemail@provider.fr" - And I fill in "speaker[biography]" with "Ma biographie" - And I attach the file "avatar1.png" to "speaker[photoFile]" - And I press "Sauvegarder" - # Nouvelle proposition - When I follow "Nouvelle proposition" - Then I should see "Le CFP n'est pas encore ouvert." + Then I should see "Mes propositions" + Then I should not see "Nouvelle proposition" + Then I should not see "Mon profil conférencier" + Then I should not see "Modifier" + Given I am on "/event/passed/cfp/speaker" + Then I should see "Le CFP est fermé" + Given I am on "/event/passed/cfp/propose" + Then I should see "Le CFP est fermé" + + Scenario: Le CFP est terminé + Given I am on "/event/passed/cfp" + Then I should see "Oauth login test" + When I follow "Connect as userGithub1" + Then I should see "Mon espace conférencier" + Then I should see "Mes propositions" + Then I should not see "Nouvelle proposition" + Then I should not see "Mon profil conférencier" + Then I should not see "Modifier" + Given I am on "/event/passed/cfp/speaker" + Then I should see "Le CFP est fermé" + Given I am on "/event/passed/cfp/propose" + Then I should see "Le CFP est fermé" Scenario: On vote pour une conférence Given I am on "/event/afup-day-lyon/vote"