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