BigW Consortium Gitlab

appearances_helper.rb 816 Bytes
Newer Older
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 20 21 22 23
    markdown(brand_item.description)
  end

  def brand_item
    @appearance ||= Appearance.first
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
33

34
  def custom_icon(icon_name, size: 16)
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
37
    render "shared/icons/#{icon_name}.svg", size: size
38
  end
39
end