Module: AppearancesHelper

Includes:
Gitlab::Utils::StrongMemoize, MarkupHelper
Included in:
EmailsHelper
Defined in:
app/helpers/appearances_helper.rb

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Methods included from MarkupHelper

#asciidoc?, #cross_project_reference, #first_line_in_markdown, #gitlab_markdown?, #link_to_html, #link_to_markdown, #link_to_markdown_field, #markdown, #markdown_field, #markup, #markup?, #markup_unsafe, #plain?, #render_wiki_content

Instance Method Details

#brand_header_logo(options = {}) ⇒ Object


38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/helpers/appearances_helper.rb', line 38

def (options = {})
  add_gitlab_white_text = options[:add_gitlab_white_text] || false
  add_gitlab_black_text = options[:add_gitlab_black_text] || false

  if current_appearance&.header_logo?
    image_tag current_appearance.header_logo_path, class: 'brand-header-logo'
  elsif add_gitlab_white_text
    render partial: 'shared/logo_with_white_text', formats: :svg
  elsif add_gitlab_black_text
    render partial: 'shared/logo_with_black_text', formats: :svg
  else
    render partial: 'shared/logo', formats: :svg
  end
end

#brand_imageObject


16
17
18
# File 'app/helpers/appearances_helper.rb', line 16

def brand_image
  image_tag(current_appearance.logo_path) if current_appearance&.logo?
end

#brand_new_project_guidelinesObject


24
25
26
# File 'app/helpers/appearances_helper.rb', line 24

def brand_new_project_guidelines
  markdown_field(current_appearance, :new_project_guidelines)
end

#brand_profile_image_guidelinesObject


28
29
30
# File 'app/helpers/appearances_helper.rb', line 28

def brand_profile_image_guidelines
  markdown_field(current_appearance, :profile_image_guidelines)
end

#brand_textObject


20
21
22
# File 'app/helpers/appearances_helper.rb', line 20

def brand_text
  markdown_field(current_appearance, :description)
end

#brand_titleObject


7
8
9
# File 'app/helpers/appearances_helper.rb', line 7

def brand_title
  current_appearance&.title.presence || default_brand_title
end

#current_appearanceObject


32
33
34
35
36
# File 'app/helpers/appearances_helper.rb', line 32

def current_appearance
  strong_memoize(:current_appearance) do
    Appearance.current
  end
end

#default_brand_titleObject


11
12
13
14
# File 'app/helpers/appearances_helper.rb', line 11

def default_brand_title
  # This resides in a separate method so that EE can easily redefine it.
  'GitLab Community Edition'
end

62
63
64
65
66
# File 'app/helpers/appearances_helper.rb', line 62

def footer_message
  return unless current_appearance&.show_footer?

  render_message(:footer_message)
end

#header_messageObject


53
54
55
56
57
58
59
60
# File 'app/helpers/appearances_helper.rb', line 53

def header_message
  return unless current_appearance&.show_header?

  class_names = []
  class_names << 'with-performance-bar' if performance_bar_enabled?

  render_message(:header_message, class_names: class_names)
end