implement manual event management and support for multiple speakers per event

This commit is contained in:
Eugene Dubinin 2017-02-02 16:34:59 +02:00
parent 46a6a59622
commit 790e2fd3a2
24 changed files with 180 additions and 89 deletions

View file

@ -5,7 +5,7 @@ module Admin
load_and_authorize_resource :event, through: :program
load_and_authorize_resource :events_registration, only: :toggle_attendance
before_action :get_event, except: [:index, :create]
before_action :get_event, except: [:index, :create, :new]
# FIXME: The timezome should only be applied on output, otherwise
# you get lost in timezone conversions...
@ -62,6 +62,7 @@ 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
@ -79,6 +80,8 @@ module Admin
end
def update
@users = User.all.order(:name)
@languages = @program.languages_list
if @event.update_attributes(event_params)
if request.xhr?
@ -94,7 +97,26 @@ module Admin
end
end
def create; end
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
if @event.save
ahoy.track 'Event submission', title: 'New submission'
redirect_to admin_conference_program_events_path(@conference.short_title), notice: 'Event was successfully submitted.'
else
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new'
end
end
def new
@url = admin_conference_program_events_path(@conference.short_title, @event)
@languages = @program.languages_list
@users = User.all.order(:name)
end
def accept
send_mail = @event.program.conference.email_settings.send_on_accepted
@ -161,7 +183,8 @@ module Admin
# Set only in admin/events controller
:track_id, :state, :language, :is_highlight, :max_attendees,
# Not used anymore?
:proposal_additional_speakers, :user, :users_attributes)
:proposal_additional_speakers, :user, :users_attributes,
speaker_ids: [])
end
def comment_params

View file

@ -13,9 +13,8 @@ class ProposalsController < ApplicationController
end
def show
# FIXME: We should show more than the first speaker
@speaker = @event.speakers.first || @event.submitter
@event_schedule = @event.event_schedules.find_by(schedule_id: @program.selected_schedule_id)
@speakers_ordered = @event.speakers_ordered
end
def new
@ -26,6 +25,7 @@ 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
@ -48,11 +48,8 @@ class ProposalsController < ApplicationController
# User which creates the proposal is both `submitter` and `speaker` of proposal
# by default.
# TODO: Allow submitter to add speakers to proposals
@event.event_users.new(user: current_user,
event_role: 'submitter')
@event.event_users.new(user: current_user,
event_role: 'speaker')
@event.speakers = [current_user]
@event.submitter = current_user
if @event.save
ahoy.track 'Event submission', title: 'New submission'
redirect_to conference_program_proposals_path(@conference.short_title), notice: 'Proposal was successfully submitted.'
@ -64,6 +61,7 @@ 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),
@ -147,7 +145,9 @@ class ProposalsController < ApplicationController
def event_params
params.require(:event).permit(:event_type_id, :track_id, :difficulty_level_id,
:title, :subtitle, :abstract, :description,
:require_registration, :max_attendees, :language)
:require_registration, :max_attendees, :language,
speaker_ids: []
)
end
def user_params