2016-04-02 18:10:28 +05:30
|
|
|
class Admin::AppearancesController < Admin::ApplicationController
|
|
|
|
before_action :set_appearance, except: :create
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def preview_sign_in
|
|
|
|
render 'preview_sign_in', layout: 'devise'
|
2016-04-02 18:10:28 +05:30
|
|
|
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
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
def favicon
|
|
|
|
@appearance.remove_favicon!
|
|
|
|
@appearance.save
|
|
|
|
|
|
|
|
redirect_to admin_appearances_path, notice: 'Favicon was succesfully removed.'
|
|
|
|
end
|
|
|
|
|
2016-04-02 18:10:28 +05:30
|
|
|
private
|
|
|
|
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
def set_appearance
|
2017-09-10 17:25:29 +05:30
|
|
|
@appearance = Appearance.current || Appearance.new
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
# Only allow a trusted parameter "white list" through.
|
|
|
|
def appearance_params
|
2018-05-09 12:01:36 +05:30
|
|
|
params.require(:appearance).permit(allowed_appearance_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
def allowed_appearance_params
|
|
|
|
%i[
|
|
|
|
title
|
|
|
|
description
|
|
|
|
logo
|
|
|
|
logo_cache
|
|
|
|
header_logo
|
|
|
|
header_logo_cache
|
2018-11-08 19:23:39 +05:30
|
|
|
favicon
|
|
|
|
favicon_cache
|
2018-05-09 12:01:36 +05:30
|
|
|
new_project_guidelines
|
|
|
|
updated_by
|
|
|
|
]
|
2016-04-02 18:10:28 +05:30
|
|
|
end
|
|
|
|
end
|