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:
parent
e6bb168c5e
commit
58974d6914
26 changed files with 194 additions and 188 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,13 +3,6 @@ class CommercialsController < ApplicationController
|
|||
before_action :set_event
|
||||
load_and_authorize_resource through: :event
|
||||
|
||||
def new
|
||||
@commercial = @event.commercials.build
|
||||
authorize! :new, @commercial
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@commercial = @event.commercials.build(commercial_params)
|
||||
authorize! :create, @commercial
|
||||
|
|
@ -35,10 +28,14 @@ class CommercialsController < ApplicationController
|
|||
|
||||
def destroy
|
||||
@commercial.destroy
|
||||
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id),
|
||||
redirect_to edit_conference_proposal_path(conference_id: @conference.short_title, id: @event.id, anchor: 'commercials-content'),
|
||||
notice: 'Commercial was successfully destroyed.'
|
||||
end
|
||||
|
||||
def get_html
|
||||
render text: Commercial.get_content(params[:url])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_event
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ class ProposalController < ApplicationController
|
|||
def edit
|
||||
authorize! :edit, @event
|
||||
@url = conference_proposal_path(@conference.short_title, params[:id])
|
||||
@commercial = @event.commercials.build
|
||||
authorize! :new, @commercial
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue