2014-08-30 12:08:24 +02:00
|
|
|
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
|
2016-03-16 11:20:56 +05:30
|
|
|
redirect_to admin_conference_splashpage_path, error: 'An error prohibited this Splashpage from being destroyed: '\
|
2014-08-30 12:08:24 +02:00
|
|
|
"#{@splashpage.errors.full_messages.join('. ')}."
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def splashpage_params
|
2015-10-28 18:05:15 +02:00
|
|
|
params.require(:splashpage).permit(:public,
|
|
|
|
|
:include_tracks, :include_program, :include_cfp,
|
|
|
|
|
:include_venue, :include_registrations,
|
|
|
|
|
:include_tickets, :include_lodgings,
|
2017-07-27 11:22:14 +03:00
|
|
|
:include_sponsors, :include_social_media,
|
|
|
|
|
:include_booths)
|
2014-08-30 12:08:24 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|