validate track name, render instead of redirect for campaigns, fix view for new sponsor
This commit is contained in:
parent
5fb7e5cbef
commit
2c768a358a
3 changed files with 9 additions and 11 deletions
|
|
@ -15,9 +15,8 @@ module Admin
|
||||||
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
redirect_to(admin_conference_campaigns_path(conference_id: @conference.short_title),
|
||||||
notice: 'Campaign successfully created.')
|
notice: 'Campaign successfully created.')
|
||||||
else
|
else
|
||||||
redirect_to(new_admin_conference_campaign_path(conference_id: @conference.short_title),
|
flash[:error] = 'Campaign creation failed. ' + @campaign.errors.full_messages.to_sentence
|
||||||
alert: "Creating of Campaign for #{@conference.short_title} failed." \
|
render action: 'new'
|
||||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -31,11 +30,8 @@ module Admin
|
||||||
conference_id: @conference.short_title),
|
conference_id: @conference.short_title),
|
||||||
notice: "Campaign '#{@campaign.name}' successfully updated.")
|
notice: "Campaign '#{@campaign.name}' successfully updated.")
|
||||||
else
|
else
|
||||||
redirect_to(edit_admin_conference_campaign_path(
|
flash[:error] = 'Campaign update failed. ' + @campaign.errors.full_messages.to_sentence
|
||||||
conference_id: @conference.short_title,
|
render action: 'edit'
|
||||||
id: @campaign.id),
|
|
||||||
alert: "Update of Campaign for #{@conference.short_title} failed." \
|
|
||||||
"#{@campaign.errors.full_messages.join('. ')}.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ class Track < ActiveRecord::Base
|
||||||
|
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
|
||||||
|
validates :name, presence: true
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_guid
|
def generate_guid
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
.row
|
.row
|
||||||
.col-md-12
|
.col-md-12
|
||||||
.page-header
|
.page-header
|
||||||
-if @sponsor.new_record?
|
|
||||||
New
|
|
||||||
%h1
|
%h1
|
||||||
|
-if @sponsor.new_record?
|
||||||
|
New
|
||||||
Sponsor
|
Sponsor
|
||||||
= @sponsor.name
|
= @sponsor.name
|
||||||
.row
|
.row
|
||||||
|
|
@ -16,4 +16,4 @@
|
||||||
= f.input :website_url
|
= f.input :website_url
|
||||||
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
= f.input :sponsorship_level, collection: @conference.sponsorship_levels
|
||||||
%p.text-right
|
%p.text-right
|
||||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue