Implement simplified commercials workflow

It's now possible to simply enter the url of the third party provider to enter a commercial.
This commit is contained in:
chrisbr 2015-04-22 21:30:32 +02:00
parent e6bb168c5e
commit 58974d6914
26 changed files with 194 additions and 188 deletions

View file

@ -5,15 +5,11 @@ module Admin
def index
@commercials = @conference.commercials
end
def new
@commercial = @conference.commercials.build
authorize! :create, @conference.commercials.new
authorize! :create, @commercial
end
def edit; end
def create
@commercial = @conference.commercials.build(commercial_params)
authorize! :create, @commercial
@ -22,8 +18,8 @@ module Admin
redirect_to admin_conference_commercials_path,
notice: 'Commercial was successfully created.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
render :new
redirect_to admin_conference_commercials_path,
error: "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
end
end
@ -32,8 +28,8 @@ module Admin
redirect_to admin_conference_commercials_path,
notice: 'Commercial was successfully updated.'
else
flash[:error] = "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
render :edit
redirect_to admin_conference_commercials_path,
error: "An error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
end
end
@ -42,6 +38,10 @@ module Admin
redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully destroyed.'
end
def get_html
render text: Commercial.get_content(params[:url])
end
private
def commercial_params