Class: PostRunner::ViewTop
- Inherits:
-
Object
- Object
- PostRunner::ViewTop
- Defined in:
- lib/postrunner/ViewTop.rb
Overview
This class generates the top part of the HTML page. It contains the logo and the menu and navigation buttons.
Instance Method Summary collapse
-
#initialize(views, pages) ⇒ ViewTop
constructor
Create a ViewTop object.
-
#to_html(doc) ⇒ Object
Generate the HTML code to that describes the top section.
Constructor Details
#initialize(views, pages) ⇒ ViewTop
Create a ViewTop object.
25 26 27 28 |
# File 'lib/postrunner/ViewTop.rb', line 25 def initialize(views, pages) @views = views @pages = pages end |
Instance Method Details
#to_html(doc) ⇒ Object
Generate the HTML code to that describes the top section.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/postrunner/ViewTop.rb', line 32 def to_html(doc) doc.unique(:viewtop_style) { doc.head { doc.style(style) } } doc.div({ :class => 'titlebar' }) { doc.div('PostRunner', { :class => 'title' }) page_selector = NavButtonRow.new('right') @pages.each do |p| page_selector.addButton(p.icon, p.url) end page_selector.to_html(doc) view_selector = NavButtonRow.new @views.each do |v| view_selector.addButton(v.icon, v.url) end view_selector.to_html(doc) } end |