Add helper function for speaker selection
The line '@users = User.all.order(:name)' is replicated a lot of times in EventsController and ProposalsController. So, this commit removes it and adds a helper function 'speaker_selector_input' that generates the field where the @users variable was used. Also, it makes the query more specific. Fix #1455 Other changes: * Include the username in the drop down menu * Add .active scope to User and corresponding tests * Add :disabled trait to User factory
This commit is contained in:
parent
36b8088726
commit
fa56ff7f6d
7 changed files with 25 additions and 9 deletions
|
|
@ -62,7 +62,6 @@ module Admin
|
|||
@comments = @event.root_comments
|
||||
@comment_count = @event.comment_threads.count
|
||||
@user = @event.submitter
|
||||
@users = User.all.order(:name)
|
||||
@url = admin_conference_program_event_path(@conference.short_title, @event)
|
||||
@languages = @program.languages_list
|
||||
end
|
||||
|
|
@ -80,7 +79,6 @@ module Admin
|
|||
end
|
||||
|
||||
def update
|
||||
@users = User.all.order(:name)
|
||||
@languages = @program.languages_list
|
||||
if @event.update_attributes(event_params)
|
||||
|
||||
|
|
@ -99,7 +97,6 @@ module Admin
|
|||
|
||||
def create
|
||||
@url = admin_conference_program_events_path(@conference.short_title, @event)
|
||||
@users = User.all.order(:name)
|
||||
@languages = @program.languages_list
|
||||
@event.submitter = current_user
|
||||
|
||||
|
|
@ -115,7 +112,6 @@ module Admin
|
|||
def new
|
||||
@url = admin_conference_program_events_path(@conference.short_title, @event)
|
||||
@languages = @program.languages_list
|
||||
@users = User.all.order(:name)
|
||||
end
|
||||
|
||||
def accept
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ class ProposalsController < ApplicationController
|
|||
|
||||
def edit
|
||||
@url = conference_program_proposal_path(@conference.short_title, params[:id])
|
||||
@users = User.all.order(:name)
|
||||
@languages = @program.languages_list
|
||||
end
|
||||
|
||||
|
|
@ -61,7 +60,6 @@ class ProposalsController < ApplicationController
|
|||
|
||||
def update
|
||||
@url = conference_program_proposal_path(@conference.short_title, params[:id])
|
||||
@users = User.all.order(:name)
|
||||
|
||||
if @event.update(event_params)
|
||||
redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue