Module: AppearancesHelper

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

Instance Method Summary collapse

Methods included from MarkupHelper

#cross_project_reference, #first_line_in_markdown, #link_to_html, #link_to_markdown, #link_to_markdown_field, #markdown, #markdown_field, #markup, #render_wiki_content

Instance Method Details

#appearance_apple_touch_iconObject



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

def appearance_apple_touch_icon
  link_tags = favicon_link_tag('apple-touch-icon.png', rel: 'apple-touch-icon')

  return link_tags unless current_appearance&.pwa_icon.present?

  link_tags = favicon_link_tag(
    appearance_pwa_icon_path_scaled(Appearance::ALLOWED_PWA_ICON_SCALER_WIDTHS.first),
    rel: 'apple-touch-icon'
  )

  Appearance::ALLOWED_PWA_ICON_SCALER_WIDTHS.each do |width|
    link_tags += "\n"
    link_tags += favicon_link_tag(appearance_pwa_icon_path_scaled(width),
      sizes: "#{width}x#{width}", rel: 'apple-touch-icon')
  end

  link_tags
end

#appearance_maskable_logoObject



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

def 
  append_root_path('/-/pwa-icons/maskable-logo.png')
end

#appearance_pwa_descriptionObject



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

def appearance_pwa_description
  current_appearance&.pwa_description.presence ||
    _("The complete DevOps platform. " \
      "One application with endless possibilities. " \
      "Organizations rely on GitLab’s source code management, " \
      "CI/CD, security, and more to deliver software rapidly.")
end

#appearance_pwa_icon_path_scaled(width) ⇒ Object



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

def appearance_pwa_icon_path_scaled(width)
  return unless Appearance::ALLOWED_PWA_ICON_SCALER_WIDTHS.include?(width)

  append_root_path((current_appearance&.pwa_icon_path_scaled(width) || "/-/pwa-icons/logo-#{width}.png"))
end

#appearance_pwa_nameObject



52
53
54
# File 'app/helpers/appearances_helper.rb', line 52

def appearance_pwa_name
  current_appearance&.pwa_name.presence || _('GitLab')
end

#appearance_pwa_short_nameObject



56
57
58
# File 'app/helpers/appearances_helper.rb', line 56

def appearance_pwa_short_name
  current_appearance&.pwa_short_name.presence || _('GitLab')
end

#append_root_path(path) ⇒ Object



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

def append_root_path(path)
  Gitlab::Utils.append_path(Gitlab.config.gitlab.relative_url_root, path)
end

#brand_header_logo(options = {}) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'app/helpers/appearances_helper.rb', line 105

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

  if current_appearance&.header_logo?
    image_tag current_appearance.header_logo_path, class: 'brand-header-logo', alt: ''
  elsif add_gitlab_logo_text
    render partial: 'shared/logo_with_text', formats: :svg
  else
    render partial: 'shared/logo', formats: :svg
  end
end

#brand_imageObject



73
74
75
# File 'app/helpers/appearances_helper.rb', line 73

def brand_image
  image_tag(brand_image_path, alt: brand_title, class: 'gl-invisible gl-h-10 js-portrait-logo-detection')
end

#brand_image_pathObject



77
78
79
80
81
# File 'app/helpers/appearances_helper.rb', line 77

def brand_image_path
  return current_appearance.logo_path if current_appearance&.logo?

  image_path('logo.svg')
end

#brand_member_guidelinesObject



87
88
89
# File 'app/helpers/appearances_helper.rb', line 87

def brand_member_guidelines
  markdown_field(current_appearance, :member_guidelines)
end

#brand_new_project_guidelinesObject



91
92
93
# File 'app/helpers/appearances_helper.rb', line 91

def brand_new_project_guidelines
  markdown_field(current_appearance, :new_project_guidelines)
end

#brand_profile_image_guidelinesObject



95
96
97
# File 'app/helpers/appearances_helper.rb', line 95

def brand_profile_image_guidelines
  markdown_field(current_appearance, :profile_image_guidelines)
end

#brand_titleObject



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

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

#current_appearanceObject



99
100
101
102
103
# File 'app/helpers/appearances_helper.rb', line 99

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

#custom_sign_in_brand_titleObject



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

def 
  # no-op overridden in EE
end

#custom_sign_in_descriptionObject



83
84
85
# File 'app/helpers/appearances_helper.rb', line 83

def 
  markdown_field(current_appearance, :description)
end

#custom_sign_up_brand_titleObject



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

def 
  # no-op overridden in EE
end

#default_brand_titleObject



68
69
70
71
# File 'app/helpers/appearances_helper.rb', line 68

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


126
127
128
129
130
# File 'app/helpers/appearances_helper.rb', line 126

def footer_message
  return unless current_appearance&.show_footer?

  render_message(:footer_message)
end

#header_messageObject



117
118
119
120
121
122
123
124
# File 'app/helpers/appearances_helper.rb', line 117

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