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"),
  Link.new("How it Works", "https://www.heroku.com/how"),
  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



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

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

  # Build HTML wrapper
  out = "
    <div class='fuji #{css_class}'>
      <div class='fuji-container'>
        <h1 class='fuji-brand'>
          <a class='fuji-logo' href='#{Fuji.options[:logo_url]}'>
            #{Fuji.options[:logo_text]} <span class='fuji-logo-subtext'>#{Fuji.options[:logo_subtext]}</span>
          </a>
        </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