Fix call for papers validation
This commit is contained in:
parent
e4c19ab1f6
commit
02691f8bf9
1 changed files with 17 additions and 11 deletions
|
|
@ -10,23 +10,29 @@ class Admin::CallforpapersController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@cfp = @conference.call_for_papers
|
@cfp = @conference.call_for_papers
|
||||||
@cfp.update_attributes(params[:call_for_papers])
|
if @cfp.update_attributes(params[:call_for_papers])
|
||||||
redirect_to(admin_conference_callforpapers_path(
|
|
||||||
id: @conference.short_title),
|
|
||||||
notice: 'Call for Papers was successfully updated.')
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
@cfp = CallForPapers.new(params[:call_for_papers])
|
|
||||||
@conference.call_for_papers = @cfp
|
|
||||||
if @cfp.save
|
|
||||||
redirect_to(admin_conference_callforpapers_path(
|
redirect_to(admin_conference_callforpapers_path(
|
||||||
id: @conference.short_title),
|
id: @conference.short_title),
|
||||||
notice: 'Call for Papers was successfully updated.')
|
notice: 'Call for Papers was successfully updated.')
|
||||||
else
|
else
|
||||||
redirect_to(admin_conference_callforpapers_path(
|
redirect_to(admin_conference_callforpapers_path(
|
||||||
id: @conference.short_title),
|
id: @conference.short_title),
|
||||||
error: 'Call for Papers failed.')
|
alert: "Updating call for papers failed. #{@cfp.errors.to_a.join(". ")}.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@cfp = CallForPapers.new(params[:call_for_papers])
|
||||||
|
if @cfp.valid?
|
||||||
|
@cfp.save
|
||||||
|
@conference.call_for_papers = @cfp
|
||||||
|
redirect_to(admin_conference_callforpapers_path(
|
||||||
|
id: @conference.short_title),
|
||||||
|
notice: 'Call for Papers was successfully created.')
|
||||||
|
else
|
||||||
|
redirect_to(admin_conference_callforpapers_path(
|
||||||
|
id: @conference.short_title),
|
||||||
|
alert: "Creating the call for papers failed. #{@cfp.errors.to_a.join(". ")}.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue