2014-07-11 10:16:44 -04:00
|
|
|
module AppearancesHelper
|
2014-07-11 08:05:40 -04:00
|
|
|
def brand_title
|
2016-02-22 14:49:16 -05:00
|
|
|
if brand_item && brand_item.title
|
|
|
|
brand_item.title
|
|
|
|
else
|
|
|
|
'GitLab Community Edition'
|
|
|
|
end
|
2014-07-11 08:05:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def brand_image
|
2016-02-22 14:49:16 -05:00
|
|
|
if brand_item.logo?
|
|
|
|
image_tag brand_item.logo
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
2014-07-11 08:05:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def brand_text
|
2016-10-06 18:01:42 -04:00
|
|
|
markdown_field(brand_item, :description)
|
2016-02-22 14:49:16 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def brand_item
|
|
|
|
@appearance ||= Appearance.first
|
2014-07-11 08:05:40 -04:00
|
|
|
end
|
2015-02-25 01:58:47 -05:00
|
|
|
|
|
|
|
def brand_header_logo
|
2016-02-22 14:49:16 -05:00
|
|
|
if brand_item && brand_item.header_logo?
|
|
|
|
image_tag brand_item.header_logo
|
|
|
|
else
|
|
|
|
render 'shared/logo.svg'
|
|
|
|
end
|
2015-02-25 01:58:47 -05:00
|
|
|
end
|
2016-05-05 13:00:40 -04:00
|
|
|
|
2016-07-11 15:27:35 -04:00
|
|
|
def custom_icon(icon_name, size: 16)
|
2016-08-18 19:27:22 -04:00
|
|
|
# We can't simply do the below, because there are some .erb SVGs.
|
|
|
|
# File.read(Rails.root.join("app/views/shared/icons/_#{icon_name}.svg")).html_safe
|
2016-06-24 11:37:49 -04:00
|
|
|
render "shared/icons/#{icon_name}.svg", size: size
|
2016-05-05 13:00:40 -04:00
|
|
|
end
|
2014-07-11 08:05:40 -04:00
|
|
|
end
|