debian-mirror-gitlab/app/controllers/admin/application_settings/appearances_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

103 lines
2.3 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2021-09-04 01:27:46 +05:30
class Admin::ApplicationSettings::AppearancesController < Admin::ApplicationController
2016-04-02 18:10:28 +05:30
before_action :set_appearance, except: :create
2021-01-03 14:25:43 +05:30
feature_category :navigation
2022-07-23 23:45:48 +05:30
urgency :low
2021-01-03 14:25:43 +05:30
2016-04-02 18:10:28 +05:30
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
2021-09-04 01:27:46 +05:30
redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully created.')
2016-04-02 18:10:28 +05:30
else
render action: 'show'
end
end
def update
if @appearance.update(appearance_params)
2021-09-04 01:27:46 +05:30
redirect_to admin_application_settings_appearances_path, notice: _('Appearance was successfully updated.')
2016-04-02 18:10:28 +05:30
else
render action: 'show'
end
end
def logo
@appearance.remove_logo!
@appearance.save
2021-09-04 01:27:46 +05:30
redirect_to admin_application_settings_appearances_path, notice: _('Logo was successfully removed.')
2016-04-02 18:10:28 +05:30
end
def header_logos
@appearance.remove_header_logo!
@appearance.save
2021-09-04 01:27:46 +05:30
redirect_to admin_application_settings_appearances_path, notice: _('Header logo was successfully removed.')
2016-04-02 18:10:28 +05:30
end
2023-04-23 21:23:45 +05:30
def pwa_icon
@appearance.remove_pwa_icon!
@appearance.save
redirect_to admin_application_settings_appearances_path,
notice: _('Progressive Web App (PWA) icon was successfully removed.')
end
2018-11-08 19:23:39 +05:30
def favicon
@appearance.remove_favicon!
@appearance.save
2021-09-04 01:27:46 +05:30
redirect_to admin_application_settings_appearances_path, notice: _('Favicon was successfully removed.')
2018-11-08 19:23:39 +05:30
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
2023-04-23 21:23:45 +05:30
pwa_name
pwa_short_name
pwa_description
2018-05-09 12:01:36 +05:30
logo
logo_cache
header_logo
header_logo_cache
2023-04-23 21:23:45 +05:30
pwa_icon
pwa_icon_cache
2018-11-08 19:23:39 +05:30
favicon
favicon_cache
2018-05-09 12:01:36 +05:30
new_project_guidelines
2020-05-24 23:13:21 +05:30
profile_image_guidelines
2018-05-09 12:01:36 +05:30
updated_by
2019-07-07 11:18:12 +05:30
header_message
footer_message
message_background_color
message_font_color
email_header_and_footer_enabled
2018-05-09 12:01:36 +05:30
]
2016-04-02 18:10:28 +05:30
end
end