Skip to content

Commit f04ad33

Browse files
committed
Queries sponsors only once on new event
1 parent 8cf7d58 commit f04ad33

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/views/admin/events/_form.html.haml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
:ruby
2+
all_sponsors = Sponsor.all
23
all_managers = Member.manager.sort_alphabetically
34

45
= simple_form_for [:admin, @event] do |f|
@@ -37,13 +38,13 @@
3738
%p
3839
%strong Please add sponsors only to either Standard level OR Gold/Silver/Bronze levels.
3940
.col-12
40-
= f.association :sponsors, label: 'Standard sponsors', input_html: { data: { placeholder: 'Select standard sponsors' }}, collection: Sponsor.all
41+
= f.association :sponsors, label: 'Standard sponsors', input_html: { data: { placeholder: 'Select standard sponsors' }}, collection: all_sponsors
4142
.col-12.col-md-6.col-lg-4
42-
= f.association :bronze_sponsors, input_html: { data: { placeholder: 'Select bronze sponsors' }}, collection: Sponsor.all
43+
= f.association :bronze_sponsors, input_html: { data: { placeholder: 'Select bronze sponsors' }}, collection: all_sponsors
4344
.col-12.col-md-6.col-lg-4
44-
= f.association :silver_sponsors, input_html: { data: { placeholder: 'Select silver sponsors' }}, collection: Sponsor.all
45+
= f.association :silver_sponsors, input_html: { data: { placeholder: 'Select silver sponsors' }}, collection: all_sponsors
4546
.col-12.col-md-6.col-lg-4
46-
= f.association :gold_sponsors, input_html: { data: { placeholder: 'Select gold sponsors' }}, collection: Sponsor.all
47+
= f.association :gold_sponsors, input_html: { data: { placeholder: 'Select gold sponsors' }}, collection: all_sponsors
4748
.col-12
4849
= f.input :organisers, collection: all_managers, value_method: :id, label_method: :full_name, selected: @event.organisers.pluck(&:id), input_html: { multiple: true }
4950
.col-12

0 commit comments

Comments
 (0)