Only show active conference participants as speakers

- Instead of showing Users from all the events, only use
  the current conference participants instead
This commit is contained in:
Nemo 2018-03-19 01:04:23 +05:30
parent 5f70c54d8e
commit 6bf356223a
2 changed files with 8 additions and 7 deletions

View file

@ -126,12 +126,13 @@ module ApplicationHelper
safe_join(event.speakers.map{ |speaker| link_to speaker.name, admin_user_path(speaker) }, ',') safe_join(event.speakers.map{ |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
end end
def speaker_selector_input(form) def speaker_selector_input(form, conference)
users = User.active.pluck(:id, :username).map { |user| users = conference.participants.pluck(:id, :username).map do |user|
[user[0], user[1]] [user[0], user[1]]
}.sort_by { |user| end
user[1].downcase
} users = users.sort_by { |user| user[1].downcase }
form.input :speakers, as: :select, form.input :speakers, as: :select,
collection: options_for_select(users.map {|user| [user[1], user[0]]}, @event.speakers.map(&:id)), collection: options_for_select(users.map {|user| [user[1], user[0]]}, @event.speakers.map(&:id)),
include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' } include_blank: false, label: 'Speakers', input_html: { class: 'select-help-toggle', multiple: 'true' }

View file

@ -4,7 +4,7 @@
= f.input :subtitle, as: :string = f.input :subtitle, as: :string
= speaker_selector_input f = speaker_selector_input f, @conference
= track_selector_input f = track_selector_input f