Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sources/AppBundle/Controller/Event/CFP/EditAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
9 changes: 2 additions & 7 deletions sources/AppBundle/Controller/Event/CFP/ProposeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
]);
Expand All @@ -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 !'));
Expand Down
8 changes: 2 additions & 6 deletions sources/AppBundle/Controller/Event/CFP/SidebarRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 '';
}

Expand Down
5 changes: 2 additions & 3 deletions sources/AppBundle/Controller/Event/CFP/SpeakerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(),
]);
Expand Down
11 changes: 4 additions & 7 deletions sources/AppBundle/Controller/Event/Speaker/SuggestionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 8 additions & 7 deletions templates/event/cfp/closed.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{% extends 'event/cfp/base.html.twig' %}

{% block content %}
<h1>CFP: {{ event.title }}</h1>
<p>{{ 'Désolé ! Le CFP est terminé pour cet évènement !' }}</p>
<p>{{ 'L\'accès est réservés à celles et ceux ayant déjà proposé des conférences.' }}</p>
<a href="{{ url('cfp', {eventSlug: event.path}) }}">
{{ 'Accès à mes conférences'|trans }}
<svg id="octocat" aria-hidden="true" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
<div class="col-md-8">
<h1>CFP: {{ event.title }}</h1>
<p>Désolé ... le CFP est fermé pour cet évènement !</p>
<a href="{{ url('cfp', {eventSlug: event.path}) }}">
Accès à mes conférences
<svg id="octocat" aria-hidden="true" height="32" version="1.1" viewBox="0 0 16 16" width="32"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"></path></svg>
</a>
</div>
{% endblock %}
2 changes: 2 additions & 0 deletions templates/event/cfp/home.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<h2>CFP: {{ event.title }}</h2>
<h3>{{ 'Mon espace conférencier'|trans }}</h3>
<div class="mlm">
{% if event.cfpOpen %}
<p class="right mrm"><a href="{{ url('cfp_speaker', {eventSlug: event.path}) }}">Modifier</a></p>
{% endif %}
{% if speaker.id == 0 %}
<p>{{ 'Vous n\'avez pas encore rempli votre profil conférencier.'|trans }}</p>
{% else %}
Expand Down
10 changes: 0 additions & 10 deletions templates/event/speaker-suggestion/closed.html.twig

This file was deleted.

34 changes: 22 additions & 12 deletions tests/behat/features/EventPages/Cfp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down