Commit d1a54a41 authored by Tiago Botelho's avatar Tiago Botelho Committed by André Luís

Makes use of the current_appearance helper method

parent 167bcdd3
......@@ -2,28 +2,28 @@ module AppearancesHelper
prepend EE::AppearancesHelper
def brand_title
brand_item&.title.presence || 'GitLab Enterprise Edition'
current_appearance&.title.presence || 'GitLab Enterprise Edition'
end
def brand_image
image_tag(brand_item.logo) if brand_item&.logo?
image_tag(current_appearance.logo) if current_appearance&.logo?
end
def brand_text
markdown_field(brand_item, :description)
markdown_field(current_appearance, :description)
end
def brand_new_project_guidelines
markdown_field(brand_item, :new_project_guidelines)
markdown_field(current_appearance, :new_project_guidelines)
end
def brand_item
def current_appearance
@appearance ||= Appearance.current
end
def brand_header_logo
if brand_item&.header_logo?
image_tag brand_item.header_logo
if current_appearance&.header_logo?
image_tag current_appearance.header_logo
else
render 'shared/logo.svg'
end
......@@ -31,7 +31,7 @@ module AppearancesHelper
# Skip the 'GitLab' type logo when custom brand logo is set
def brand_header_logo_type
unless brand_item&.header_logo?
unless current_appearance&.header_logo?
render 'shared/logo_type.svg'
end
end
......
......@@ -54,9 +54,9 @@ module EmailsHelper
end
def header_logo
if brand_item && brand_item.header_logo?
if current_appearance&.header_logo?
image_tag(
brand_item.header_logo,
current_appearance.header_logo,
style: 'height: 50px'
)
else
......
......@@ -4,9 +4,9 @@
%body{ class: "#{user_application_theme} #{@body_class}", data: { page: body_data_page, project: "#{@project.path if @project}", group: "#{@group.path if @group}", find_file: find_file_path } }
= render "layouts/init_auto_complete" if @gfm_form
= render 'peek/bar'
= header_message(@appearance)
= header_message
= render "layouts/header/default"
= render 'layouts/page', sidebar: sidebar, nav: nav
= footer_message(@appearance)
= footer_message
= yield :scripts_body
......@@ -2,7 +2,7 @@
%html.devise-layout-html{ class: system_message_class }
= render "layouts/head"
%body.ui_indigo.login-page.application.navless{ data: { page: body_data_page } }
= header_message(@appearance)
= header_message
.page-wrap
= render "layouts/header/empty"
.login-page-broadcast
......@@ -17,7 +17,7 @@
%h1
= brand_title
= brand_image
- if brand_item&.description?
- if current_appearance&.description?
= brand_text
- else
%h3 Open source software to collaborate on code
......@@ -41,4 +41,4 @@
= link_to "Explore", explore_root_path
= link_to "Help", help_path
= link_to "About GitLab", "https://about.gitlab.com/"
= footer_message(@appearance)
= footer_message
......@@ -2,7 +2,7 @@
%html{ lang: "en", class: system_message_class }
= render "layouts/head"
%body.ui_indigo.login-page.application.navless
= header_message(@appearance)
= header_message
= render "layouts/header/empty"
= render "layouts/broadcast"
.container.navless-container
......@@ -16,4 +16,4 @@
= link_to "Explore", explore_root_path
= link_to "Help", help_path
= link_to "About GitLab", "https://about.gitlab.com/"
= footer_message(@appearance)
= footer_message
module EE
module AppearancesHelper
def header_message(appearance)
return unless appearance&.show_header?
def header_message
return unless current_appearance&.show_header?
class_names = []
class_names << 'with-performance-bar' if performance_bar_enabled?
render_message(appearance, :header_message, class_names)
render_message(:header_message, class_names)
end
def footer_message(appearance)
return unless appearance&.show_footer?
def footer_message
return unless current_appearance&.show_footer?
render_message(appearance, :footer_message)
render_message(:footer_message)
end
private
def render_message(appearance, field_sym, class_names = [])
def render_message(field_sym, class_names = [])
class_names << field_sym.to_s.dasherize
content_tag :div, class: class_names, style: message_style(appearance) do
::Banzai.render_field(appearance, field_sym).html_safe
content_tag :div, class: class_names, style: message_style do
::Banzai.render_field(current_appearance, field_sym).html_safe
end
end
def message_style(appearance)
def message_style
style = ''
style << "background-color: #{appearance.background_color};"
style << "color: #{appearance.font_color}"
style << "background-color: #{current_appearance.background_color};"
style << "color: #{current_appearance.font_color}"
style
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment