Class: Kin::Masthead::Builder
- Inherits:
-
Object
- Object
- Kin::Masthead::Builder
- Includes:
- Merb::Helpers::Tag
- Defined in:
- lib/kin/masthead.rb
Overview
Most pages on Showcase have a masthead of some sort. The masthead fits beneath the main navigation and the page content. Typically it contains the page title and some other interesting information.
+--------+----------+---------+ +--------------------+
| Sets | Search | Admin | | Upload a new set |
+--------+----------+---------+--------------+--------------------+
| [Title] [Right title] |
| [Subtitle] [Right subtitle] |
+-----------------------------------------------------------------+
| |
| Page contents |
| |
+-----------------------------------------------------------------+
See the #masthead helper for more information on how to build a masthead.
Constant Summary collapse
- CSS_CLASSES =
{ :title => ''.freeze, :subtitle => 'subtitle'.freeze, :right_title => 'main'.freeze, :right_subtitle => 'subtitle'.freeze }.freeze
Instance Method Summary collapse
-
#build {|Kin::Nav::Builder| ... } ⇒ Kin::Nav::Builder
Builds a masthead.
-
#initialize ⇒ Builder
constructor
Creates a new masthead builder.
-
#right_subtitle(value = nil, options = nil) ⇒ String
Returns the current right subtitle title.
-
#right_title(value = nil, options = nil) ⇒ String
Returns the current right title.
-
#subtitle(value = nil, options = nil) ⇒ String
Returns the current subtitle.
-
#title(value = nil, options = nil) ⇒ String
Returns the current title.
-
#to_html ⇒ String
Returns the HTML representation of the masthead.
Constructor Details
#initialize ⇒ Builder
Creates a new masthead builder.
37 38 39 40 |
# File 'lib/kin/masthead.rb', line 37 def initialize @title = @right_title = @subtitle = @right_subtitle = nil = Hash.new { |hash, key| hash[key] = {} } end |
Instance Method Details
#build {|Kin::Nav::Builder| ... } ⇒ Kin::Nav::Builder
Builds a masthead.
Yields the builder instance providing a DSL for setting up the masthead as desired.
54 55 56 57 |
# File 'lib/kin/masthead.rb', line 54 def build yield self self end |
#right_subtitle(value = nil, options = nil) ⇒ String
Returns the current right subtitle title. If you supply a non-nil argument, the subtitle will be set to whatever is provided.
108 109 |
# File 'lib/kin/masthead.rb', line 108 def right_subtitle(value = nil, = nil) end |
#right_title(value = nil, options = nil) ⇒ String
Returns the current right title. If you supply a non-nil argument, the right title will be set to whatever is provided.
82 83 |
# File 'lib/kin/masthead.rb', line 82 def right_title(value = nil, = nil) end |
#subtitle(value = nil, options = nil) ⇒ String
Returns the current subtitle. If you supply a non-nil argument, the subtitle will be set to whatever is provided.
95 96 |
# File 'lib/kin/masthead.rb', line 95 def subtitle(value = nil, = nil) end |
#title(value = nil, options = nil) ⇒ String
Returns the current title. If you supply a non-nil argument, the title will be set to whatever is provided.
69 70 |
# File 'lib/kin/masthead.rb', line 69 def title(value = nil, = nil) end |
#to_html ⇒ String
Returns the HTML representation of the masthead.
137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/kin/masthead.rb', line 137 def to_html " <div id=\"masthead\">\n <div class=\"details\">\n \#{ formatted(:title, :h1) }\n \#{ formatted(:subtitle) }\n </div>\n\n \#{ extras_as_html }\n </div>\n HTML\nend\n" |