parent
7793497862
commit
fedb0753bf
42 changed files with 578 additions and 236 deletions
49
app/controllers/admin/splashpages_controller.rb
Normal file
49
app/controllers/admin/splashpages_controller.rb
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
module Admin
|
||||
class SplashpagesController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference, singleton: true
|
||||
|
||||
def show; end
|
||||
|
||||
def new
|
||||
@splashpage = @conference.build_splashpage
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@splashpage = @conference.build_splashpage(splashpage_params)
|
||||
|
||||
if @splashpage.save
|
||||
redirect_to admin_conference_splashpage_path,
|
||||
notice: 'Splashpage successfully created.'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @splashpage.update_attributes(splashpage_params)
|
||||
redirect_to admin_conference_splashpage_path,
|
||||
notice: 'Splashpage successfully updated.'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @splashpage.destroy
|
||||
redirect_to admin_conference_splashpage_path, notice: 'Splashpage was successfully destroyed.'
|
||||
else
|
||||
redirect_to admin_conference_splashpage_path, alert: "A error prohibited this Splashpage from being destroyed: "\
|
||||
"#{@splashpage.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def splashpage_params
|
||||
params[:splashpage]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
class CommercialsController < ApplicationController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_resource :conference, find_by: :short_title
|
||||
before_action :set_event
|
||||
load_and_authorize_resource through: @event, except: [:new, :create]
|
||||
load_and_authorize_resource through: :event
|
||||
|
||||
def new
|
||||
@commercial = @event.commercials.build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue