Method: Fuji::Header#render

Defined in:
lib/fuji/header.rb

#renderObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/fuji/header.rb', line 26

def render
  # Build HTML from link objects
  link_html = links.map{|l| l.html(current_page) }.join("\n")

  home = Link.new("#{Fuji.options[:logo_text]} <span class='fuji-logo-subtext'>#{Fuji.options[:logo_subtext]}</span>", Fuji.options[:logo_url], {css: "fuji-logo", skip_li: true})

  # Build HTML wrapper
  out = "
    <div class='fuji #{css_class}'>
      <div class='fuji-container'>
        <h1 class='fuji-brand'>
          #{home.html}
        </h1>

        <ul class='fuji-links'>#{link_html}</ul>
      </div>
    </div>
  "

  # If we're in Rails, make it HTML safe
  out.respond_to?(:html_safe) ? out.html_safe : out
end