Skip to content

Commit

Permalink
Ref #215: use Select2 in donation creation&edit forms
Browse files Browse the repository at this point in the history
  • Loading branch information
LucileDT committed Jul 11, 2020
1 parent 496319b commit 4c90c2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/Form/DonationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('donator', EntityType::class, [
// looks for choices from this entity
'class' => People::class,
'attr' => [
'data-toggle' => 'select2'
],
// uses firstname and lastname as the visible option string
'choice_label' => function($people) {
return $people->getFirstName() . ' ' . $people->getLastName();
Expand Down
2 changes: 1 addition & 1 deletion templates/Donation/edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>
<div id="people-selector" class="row {{ hasDonator ? 'd-none' : '' }}">
{% include 'Donation/_people_selector.html.twig'
with {'form_donator_widget' : form_widget(form.donator)} %}
with {'form_donator_widget' : form_widget(form.donator)} %}
</div>
</div>
<div class="row justify-content-between mt-3">
Expand Down

0 comments on commit 4c90c2d

Please sign in to comment.