Class: Fuji::Header

Inherits:
Renderer show all
Defined in:
lib/fuji/header.rb

Direct Known Subclasses

CustomHeader

Constant Summary collapse

ADDONS =
Link.new("Add-ons", "https://addons.heroku.com/")
DOCUMENTATION =
Link.new("Documentation", "https://devcenter.heroku.com/")
HELP =
Link.new("Help & Support", "https://help.heroku.com/", {css: "help"})
LOGGED_IN =
[
  Link.new("Apps", "https://dashboard.heroku.com/"),
  ADDONS,
  DOCUMENTATION,
  HELP,
  Link.new("Account", "https://dashboard.heroku.com/account"),
  Link.new("Log Out", "https://id.heroku.com/logout")
]
LOGGED_OUT =
[
  Link.new("Sign Up", "https://www.heroku.com/signup"),
  Link.new("Pricing", "https://www.heroku.com/pricing"),
  ADDONS,
  DOCUMENTATION,
  HELP,
  Link.new("Login", "https://id.heroku.com/login")
]

Instance Method Summary collapse

Methods inherited from Renderer

#initialize, render

Constructor Details

This class inherits a constructor from Fuji::Renderer

Instance Method Details

#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