Skip to content

Commit

Permalink
Only show active conference participants as speakers
Browse files Browse the repository at this point in the history
- Instead of showing Users from all the events, only use
  the current conference participants instead
  • Loading branch information
captn3m0 committed Mar 21, 2018
1 parent de9ab86 commit 17614ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ def speaker_links(event)
safe_join(event.speakers.map{ |speaker| link_to speaker.name, admin_user_path(speaker) }, ',')
end

def speaker_selector_input(form)
users = User.active.pluck(:id, :username).map { |user|
[user[0], user[1]]
}.sort_by { |user|
user[1].downcase
}
def speaker_selector_input(form, conference)
users = conference.participants.pluck(:id, :username).map do |user|
[user[0], user[1]]
end

users = users.sort_by { |user| user[1].downcase }

form.input :speakers, as: :select,
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' }
Expand Down
2 changes: 1 addition & 1 deletion app/views/proposals/_proposal_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

= f.input :subtitle, as: :string

= speaker_selector_input f
= speaker_selector_input f, @conference

= track_selector_input f

Expand Down

0 comments on commit 17614ce

Please sign in to comment.