2016-02-22 14:49:16 -05:00
|
|
|
class Admin::AppearancesController < Admin::ApplicationController
|
|
|
|
before_action :set_appearance, except: :create
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
def preview
|
2016-06-20 05:50:36 -04:00
|
|
|
render 'preview', layout: 'devise'
|
2016-02-22 14:49:16 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@appearance = Appearance.new(appearance_params)
|
|
|
|
|
|
|
|
if @appearance.save
|
|
|
|
redirect_to admin_appearances_path, notice: 'Appearance was successfully created.'
|
|
|
|
else
|
|
|
|
render action: 'show'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
if @appearance.update(appearance_params)
|
|
|
|
redirect_to admin_appearances_path, notice: 'Appearance was successfully updated.'
|
|
|
|
else
|
|
|
|
render action: 'show'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def logo
|
|
|
|
@appearance.remove_logo!
|
|
|
|
|
|
|
|
@appearance.save
|
|
|
|
|
|
|
|
redirect_to admin_appearances_path, notice: 'Logo was succesfully removed.'
|
|
|
|
end
|
|
|
|
|
|
|
|
def header_logos
|
|
|
|
@appearance.remove_header_logo!
|
|
|
|
@appearance.save
|
|
|
|
|
|
|
|
redirect_to admin_appearances_path, notice: 'Header logo was succesfully removed.'
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
def set_appearance
|
2017-08-09 10:41:51 -04:00
|
|
|
@appearance = Appearance.current || Appearance.new
|
2016-02-22 14:49:16 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
# Only allow a trusted parameter "white list" through.
|
|
|
|
def appearance_params
|
|
|
|
params.require(:appearance).permit(
|
|
|
|
:title, :description, :logo, :logo_cache, :header_logo, :header_logo_cache,
|
|
|
|
:updated_by
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|