appearances_helper.rb 826 字节
Newer Older
D
Dmitriy Zaporozhets 已提交
1
module AppearancesHelper
2
  def brand_title
3 4 5 6 7
    if brand_item && brand_item.title
      brand_item.title
    else
      'GitLab Community Edition'
    end
8 9 10
  end

  def brand_image
11 12 13 14 15
    if brand_item.logo?
      image_tag brand_item.logo
    else
      nil
    end
16 17 18
  end

  def brand_text
19
    markdown_field(brand_item, :description)
20 21 22
  end

  def brand_item
23
    @appearance ||= Appearance.current
24
  end
25 26

  def brand_header_logo
27 28 29 30 31
    if brand_item && brand_item.header_logo?
      image_tag brand_item.header_logo
    else
      render 'shared/logo.svg'
    end
32
  end
A
Annabel Dunstone 已提交
33

34
  def custom_icon(icon_name, size: 16)
D
Douwe Maan 已提交
35 36
    # 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
P
Phil Hughes 已提交
37
    render "shared/icons/#{icon_name}.svg", size: size
A
Annabel Dunstone 已提交
38
  end
39
end