Skip to content

Commit

Permalink
Merge pull request #271 from jolicode/fix/conferences-select-lists
Browse files Browse the repository at this point in the history
fix: limit conferences selects to future conferences
  • Loading branch information
welcoMattic authored Oct 24, 2022
2 parents eec6558 + 2cc8813 commit b1a3b4a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/packages/easy_admin/participation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ easy_admin:
item_permission: ['ROLE_PARTICIPATION_MANAGEMENT']
fields:
- { type: 'group', columns: 6, icon: 'id-badge', label: 'Participation' }
- { property: 'conference', type: 'App\Form\EasyAdmin\ParticipationConferencesType', type_options: { attr: { data-widget: 'select2' } } }
- { property: 'conference', type: 'App\Form\EasyAdmin\FutureConferencesType', type_options: { attr: { data-widget: 'select2' } } }
- { property: 'participant' }
- { property: 'asSpeaker' }
- property: 'transportStatus'
Expand Down
2 changes: 1 addition & 1 deletion config/packages/easy_admin/talk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ easy_admin:
fields:
<<: *talkFields
4: { type: 'group', columns: 6, icon: 'send', label: 'Publication' }
5: { property: 'conferences', type: 'easyadmin_autocomplete', type_options: { mapped: false, class: App\Entity\Conference, multiple: true } }
5: { property: 'conference', type: 'App\Form\EasyAdmin\FutureConferencesType', type_options: { mapped: false, class: App\Entity\Conference, multiple: true, attr: { data-widget: 'select2' } } }
6: { property: authors, type: App\Form\EasyAdmin\TalkUserType, type_options: { mapped: false, required: true } }

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ParticipationConferencesType extends AbstractType
class FutureConferencesType extends AbstractType
{
public function __construct(
private ConferenceRepository $conferenceRepository,
Expand Down
3 changes: 3 additions & 0 deletions src/Form/EasyAdmin/TalkSubmitType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use App\Entity\Submit;
use App\Entity\Talk;
use App\Entity\User;
use App\Repository\ConferenceRepository;
use EasyCorp\Bundle\EasyAdminBundle\Form\Type\EasyAdminAutocompleteType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
Expand All @@ -29,6 +30,7 @@ class TalkSubmitType extends AbstractType
{
public function __construct(
private RequestStack $requestStack,
private ConferenceRepository $conferenceRepository,
) {
}

Expand All @@ -40,6 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
])
->add('conference', EasyAdminAutocompleteType::class, [
'class' => Conference::class,
'query_builder' => $this->conferenceRepository->getFutureConferencesQueryBuilder(),
])
->add('status', ChoiceType::class, [
'choices' => array_flip(Submit::STATUS_EMOJIS),
Expand Down

0 comments on commit b1a3b4a

Please sign in to comment.