diff --git a/db/seeds/Event.php b/db/seeds/Event.php index c414a3acb..2146ce292 100644 --- a/db/seeds/Event.php +++ b/db/seeds/Event.php @@ -44,6 +44,36 @@ public function run() 'transport_information_enabled' => 1, 'has_prices_defined_with_vat' => 1, ], + [ + 'id' => 2, + 'titre' => 'AFUP Day Lyon', + 'path' => 'afup-day-lyon', + 'logo_url' => 'http://78.media.tumblr.com/tumblr_lgkqc0mz9d1qfyzelo1_1280.jpg', // oui, c'est un chat + 'nb_places' => 500, + 'date_debut' => date('Y-m-d', $event), + 'date_fin' => date('Y-m-d', $event + $oneDayInSeconds), + 'annee' => date('Y', $event), + 'text' => json_encode([ + 'fr' => 'François le français', + 'en' => 'Henri l\'anglais', + 'sponsor_management_fr' => '**Sponsors**, venez, vous serez très visible !', + 'sponsor_management_en' => '**Sponsors**, come, you will be very visible!', + 'mail_inscription_content' => 'Contenu email', + ]), + 'date_fin_appel_projet' => $now + $oneMonthInSeconds, + 'date_fin_appel_conferencier' => $event - $oneMonthInSeconds * 2, + 'date_fin_vote' => date('Y-m-d H:i:s', ($event - $oneMonthInSeconds * 2) + $oneDayInSeconds * 7), + 'date_fin_prevente' => $now + $oneMonthInSeconds, + 'date_fin_vente' => $event - $oneDayInSeconds * 7, + 'date_fin_vente_token_sponsor' => $event - $oneDayInSeconds * 7, + 'date_fin_saisie_repas_speakers' => $event - $oneDayInSeconds * 7, + 'date_fin_saisie_nuites_hotel' => $event - $oneDayInSeconds * 7, + 'place_name' => 'Paris', + 'place_address' => 'Marriott Rive Gauche', + 'date_annonce_planning' => date('Y-m-d H:i:s', $now - $oneMonthInSeconds), + 'transport_information_enabled' => 1, + 'has_prices_defined_with_vat' => 1, + ], ]; $table = $this->table('afup_forum'); diff --git a/htdocs/js/vote.js b/htdocs/js/vote.js index d43520c1b..9dd6cf27c 100644 --- a/htdocs/js/vote.js +++ b/htdocs/js/vote.js @@ -125,15 +125,17 @@ var setFormSuccess = function(form) { // Gestion de la case à cocher pour la proposition d'atelier à un CFP var textareaContainer = document.getElementById('talk_workshopAbstract'); -textareaContainer = textareaContainer.closest('div'); - -var checkbox = document.getElementById('talk_withWorkshop'); -checkbox.addEventListener('change', (event) => { - if (event.currentTarget.checked) { - textareaContainer.style.display = 'block'; - } else { - textareaContainer.style.display = 'none'; - } -}); +if (textareaContainer) { + textareaContainer = textareaContainer.closest('div'); + + var checkbox = document.getElementById('talk_withWorkshop'); + checkbox.addEventListener('change', (event) => { + if (event.currentTarget.checked) { + textareaContainer.style.display = 'block'; + } else { + textareaContainer.style.display = 'none'; + } + }); -checkbox.dispatchEvent(new Event('change')); + checkbox.dispatchEvent(new Event('change')); +} \ No newline at end of file diff --git a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php index 9b5e43b4f..54344f2c8 100644 --- a/sources/AppBundle/Controller/Event/CFP/ProposeAction.php +++ b/sources/AppBundle/Controller/Event/CFP/ProposeAction.php @@ -75,7 +75,9 @@ public function __invoke(Request $request) $talk = new Talk(); $talk->setForumId($event->getId()); - $form = $this->formFactory->create(TalkType::class, $talk); + $form = $this->formFactory->create(TalkType::class, $talk, [ + TalkType::IS_AFUP_DAY => $event->isAfupDay() + ]); if ($this->talkFormHandler->handle($request, $event, $form, $speaker)) { $this->flashBag->add('success', $this->translator->trans('Proposition enregistrée !')); diff --git a/sources/AppBundle/Event/Form/TalkType.php b/sources/AppBundle/Event/Form/TalkType.php index cc9c31b6d..b78ea9117 100644 --- a/sources/AppBundle/Event/Form/TalkType.php +++ b/sources/AppBundle/Event/Form/TalkType.php @@ -16,6 +16,7 @@ class TalkType extends AbstractType { const OPT_COC_CHECKED = 'codeOfConductChecked'; + const IS_AFUP_DAY = 'isAfupDay'; public function buildForm(FormBuilderInterface $builder, array $options) { @@ -43,16 +44,20 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'Avancé' => Talk::SKILL_SENIOR, 'N/A' => Talk::SKILL_NA ] - ]) - ->add('withWorkshop', CheckboxType::class, [ + ]); + + if (!$options[self::IS_AFUP_DAY]) { + $builder->add('withWorkshop', CheckboxType::class, [ 'label' => "Je propose de faire un atelier", 'required' => false, 'help' => 'Lors de l’événement, nous souhaitons proposer des ateliers d’une durée de 2 heures avec une vingtaine de participant(e)s qui se seront inscrit(e)s préalablement. Seulement les speakers sélectionné(e)s effectueraient un atelier. Cochez cette case et renseignez la zone de texte ci-dessous si vous souhaitez proposer un atelier.', ]) ->add('workshopAbstract', TextareaType::class, ['label' => 'Résumé de l\'atelier', 'required' => false, - ]) - ->add('needsMentoring', CheckboxType::class, [ + ]); + } + + $builder->add('needsMentoring', CheckboxType::class, [ 'label' => "Je souhaite profiter du programme d'accompagnement des jeunes speakers", 'required' => false ]) @@ -83,7 +88,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ - self::OPT_COC_CHECKED => false + self::OPT_COC_CHECKED => false, + self::IS_AFUP_DAY => false, ]); } } diff --git a/tests/behat/features/EventPages/Cfp.feature b/tests/behat/features/EventPages/Cfp.feature index 7e3e584c7..725bcee32 100644 --- a/tests/behat/features/EventPages/Cfp.feature +++ b/tests/behat/features/EventPages/Cfp.feature @@ -39,6 +39,9 @@ Feature: Event pages - CFP And I fill in "talk[abstract]" with "L'histoire des poissons rouges à travers les ages" And I fill in "talk[hasAllowedToSharingWithLocalOffices]" with "1" And I check "talk[codeOfConduct]" + # Proposition d'atelier présent + And I should see "Je propose de faire un atelier" + And I should see "nous souhaitons proposer des ateliers" And I press "Sauvegarder" Then I should not see "Cette valeur ne doit pas être vide." And I should see "Proposition enregistrée !" @@ -55,3 +58,35 @@ Feature: Event pages - CFP When I follow "Voter pour les conférences" Then I should see "Les nouvelles conférences à noter" And I should see "Généalogie des poissons rouges" + + Scenario: On crée une nouvelle proposition pour un AFUP day en tant que userGithub1 + Given I am on "/event/afup-day-lyon/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 "J'accepte le code de conduite et les conditions générales de participation" + When I fill in "talk[title]" with "Généalogie des poissons rouges" + And I fill in "talk[abstract]" with "L'histoire des poissons rouges à travers les ages" + And I fill in "talk[hasAllowedToSharingWithLocalOffices]" with "1" + And I check "talk[codeOfConduct]" + # Proposition d'atelier non présent + And I should not see "Je propose de faire un atelier" + And I should not see "nous souhaitons proposer des ateliers" + And I press "Sauvegarder" + Then I should not see "Cette valeur ne doit pas être vide." + And I should see "Proposition enregistrée !" + When I am on "/event/forum/cfp" + Then I should see "Généalogie des poissons rouges" + When I am on "/event/forum/vote" + Then I should not see "Généalogie des poissons rouges"