mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 12:44:03 +00:00
Introduce Program to include cfp/rooms/tracks/events/event_types/difficulty_levels
This commit is contained in:
parent
028b82fda8
commit
444356fbc7
117 changed files with 1812 additions and 905 deletions
58
app/controllers/admin/cfps_controller.rb
Normal file
58
app/controllers/admin/cfps_controller.rb
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
module Admin
|
||||
class CfpsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||
load_and_authorize_resource through: :program, singleton: true
|
||||
|
||||
def show; end
|
||||
|
||||
def new
|
||||
@cfp = @program.build_cfp
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@cfp = @program.build_cfp(cfp_params)
|
||||
|
||||
if @cfp.save
|
||||
redirect_to admin_conference_program_cfp_path,
|
||||
notice: 'Call for papers successfully created.'
|
||||
else
|
||||
flash[:error] = "Creating the call for papers failed. #{@cfp.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@cfp = @program.cfp
|
||||
@cfp.assign_attributes(params[:cfp])
|
||||
|
||||
send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update?
|
||||
|
||||
if @cfp.update_attributes(params[:cfp])
|
||||
Mailbot.delay.send_on_cfps_dates_updates(@conference) if send_mail_on_cfp_dates_updates
|
||||
redirect_to(admin_conference_program_cfp_path(@conference.short_title),
|
||||
notice: 'Call for papers successfully updated.')
|
||||
else
|
||||
flash[:error] = "Updating call for papers failed. #{@cfp.errors.to_a.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @cfp.destroy
|
||||
redirect_to admin_conference_program_cfp_path, notice: 'Call for Papers was successfully deleted.'
|
||||
else
|
||||
redirect_to admin_conference_program_cfp_path, error: 'An error prohibited this Call for Papers from being destroyed: '\
|
||||
"#{@cfp.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def cfp_params
|
||||
params[:cfp]
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue