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_apple_touch_icon ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/helpers/appearances_helper.rb', line 25
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_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
52
53
54
55
56
57
58
|
# File 'app/helpers/appearances_helper.rb', line 52
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
44
45
46
|
# File 'app/helpers/appearances_helper.rb', line 44
def appearance_pwa_name
current_appearance&.pwa_name.presence || _('GitLab')
end
|
#appearance_pwa_short_name ⇒ Object
48
49
50
|
# File 'app/helpers/appearances_helper.rb', line 48
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
97
98
99
100
101
102
103
104
105
106
107
|
# File 'app/helpers/appearances_helper.rb', line 97
def brand_header_logo(options = {})
add_gitlab_logo_text = options[:add_gitlab_logo_text] || false
if current_appearance&.
image_tag current_appearance., 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_image ⇒ Object
65
66
67
|
# File 'app/helpers/appearances_helper.rb', line 65
def brand_image
image_tag(brand_image_path, alt: brand_title, class: 'gl-invisible gl-h-10 js-portrait-logo-detection')
end
|
#brand_image_path ⇒ Object
69
70
71
72
73
|
# File 'app/helpers/appearances_helper.rb', line 69
def brand_image_path
return current_appearance.logo_path if current_appearance&.logo?
image_path('logo.svg')
end
|
#brand_member_guidelines ⇒ Object
79
80
81
|
# File 'app/helpers/appearances_helper.rb', line 79
def brand_member_guidelines
markdown_field(current_appearance, :member_guidelines)
end
|
#brand_new_project_guidelines ⇒ Object
83
84
85
|
# File 'app/helpers/appearances_helper.rb', line 83
def brand_new_project_guidelines
markdown_field(current_appearance, :new_project_guidelines)
end
|
#brand_profile_image_guidelines ⇒ Object
87
88
89
|
# File 'app/helpers/appearances_helper.rb', line 87
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
91
92
93
94
95
|
# File 'app/helpers/appearances_helper.rb', line 91
def current_appearance
strong_memoize(:current_appearance) do
Appearance.current
end
end
|
#custom_sign_in_description ⇒ Object
75
76
77
|
# File 'app/helpers/appearances_helper.rb', line 75
def custom_sign_in_description
markdown_field(current_appearance, :description)
end
|
#default_brand_title ⇒ Object
60
61
62
63
|
# File 'app/helpers/appearances_helper.rb', line 60
def default_brand_title
_('GitLab Community Edition')
end
|
118
119
120
121
122
|
# File 'app/helpers/appearances_helper.rb', line 118
def
return unless current_appearance&.
render_message(:footer_message)
end
|
109
110
111
112
113
114
115
116
|
# File 'app/helpers/appearances_helper.rb', line 109
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
|