Skip to content

Commit

Permalink
Merge 6bf3562 into c9a7b6f
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed Apr 16, 2018
2 parents c9a7b6f + 6bf3562 commit c5cadf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/helpers/application_helper.rb
Expand Up @@ -126,10 +126,15 @@ 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, :name, :username, :email).map { |user| [user[0], user[1].blank? ? user[2] : user[1], user[2], user[3]] }.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[2]}) #{user[3]}", 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' }
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/proposals/_proposal_form.html.haml
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 c5cadf1

Please sign in to comment.