Extracted Splashpage from Conference

#418
This commit is contained in:
Chrisbr 2014-08-30 12:08:24 +02:00
parent 7793497862
commit fedb0753bf
42 changed files with 578 additions and 236 deletions

View 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