Module: AppearancesHelper
- Includes:
- Gitlab::Utils::StrongMemoize, MarkupHelper
- Included in:
- EmailsHelper
- Defined in:
- app/helpers/appearances_helper.rb
Instance Method Summary
collapse
#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_maskable_logo ⇒ Object
13
14
15
|
# File 'app/helpers/appearances_helper.rb', line 13
def appearance_maskable_logo
append_root_path('/-/pwa-icons/maskable-logo.png')
end
|
#appearance_pwa_description ⇒ Object
33
34
35
36
37
38
39
|
# File 'app/helpers/appearances_helper.rb', line 33
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_name ⇒ Object
25
26
27
|
# File 'app/helpers/appearances_helper.rb', line 25
def appearance_pwa_name
current_appearance&.pwa_name.presence || _('GitLab')
end
|
#appearance_pwa_short_name ⇒ Object
29
30
31
|
# File 'app/helpers/appearances_helper.rb', line 29
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'app/helpers/appearances_helper.rb', line 78
def brand_header_logo(options = {})
add_gitlab_white_text = options[:add_gitlab_white_text] || false
add_gitlab_black_text = options[:add_gitlab_black_text] || false
if current_appearance&.
image_tag current_appearance., 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_image ⇒ Object
46
47
48
|
# File 'app/helpers/appearances_helper.rb', line 46
def brand_image
image_tag(brand_image_path, alt: brand_title, class: 'gl-w-10')
end
|
#brand_image_path ⇒ Object
50
51
52
53
54
|
# File 'app/helpers/appearances_helper.rb', line 50
def brand_image_path
return current_appearance.logo_path if current_appearance&.logo?
image_path('logo.svg')
end
|
#brand_new_project_guidelines ⇒ Object
64
65
66
|
# File 'app/helpers/appearances_helper.rb', line 64
def brand_new_project_guidelines
markdown_field(current_appearance, :new_project_guidelines)
end
|
#brand_profile_image_guidelines ⇒ Object
68
69
70
|
# File 'app/helpers/appearances_helper.rb', line 68
def brand_profile_image_guidelines
markdown_field(current_appearance, :profile_image_guidelines)
end
|
#brand_title ⇒ Object
21
22
23
|
# File 'app/helpers/appearances_helper.rb', line 21
def brand_title
current_appearance&.title.presence || default_brand_title
end
|
#current_appearance ⇒ Object
72
73
74
75
76
|
# File 'app/helpers/appearances_helper.rb', line 72
def current_appearance
strong_memoize(:current_appearance) do
Appearance.current
end
end
|
#custom_sign_in_description ⇒ Object
#default_brand_title ⇒ Object
41
42
43
44
|
# File 'app/helpers/appearances_helper.rb', line 41
def default_brand_title
_('GitLab Community Edition')
end
|
102
103
104
105
106
|
# File 'app/helpers/appearances_helper.rb', line 102
def
return unless current_appearance&.
render_message(:footer_message)
end
|
93
94
95
96
97
98
99
100
|
# File 'app/helpers/appearances_helper.rb', line 93
def
return unless current_appearance&.
class_names = []
class_names << 'with-performance-bar' if performance_bar_enabled?
render_message(:header_message, class_names: class_names)
end
|