class PostRunner::ViewTop
This class generates the top part of the HTML page. It contains the logo and the menu and navigation buttons.
Public Class Methods
new(views, pages)
click to toggle source
Create a ViewTop
object. @param views [Array of NavButtonDef] icons and URLs for views @param pages [Array of NavButtonDef] Full list of pages of this view.
# File lib/postrunner/ViewTop.rb, line 25 def initialize(views, pages) @views = views @pages = pages end
Public Instance Methods
to_html(doc)
click to toggle source
Generate the HTML code to that describes the top section. @param doc [HTMLBuilder] Reference to the HTML document to add to.
# 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
Private Instance Methods
style()
click to toggle source
# File lib/postrunner/ViewTop.rb, line 55 def style <<EOT .titlebar { width: 100%; min-width: 1210px; height: 50px; margin: 0px; background: linear-gradient(#7FA1FF 0, #002EAC 50px); } .title { float: left; font-size: 24pt; font-style: italic; font-weight: bold; color: #F8F8F8; text-shadow: -1px -1px 0 #5C5C5C, 1px -1px 0 #5C5C5C, -1px 1px 0 #5C5C5C, 1px 1px 0 #5C5C5C; padding: 3px 30px; } EOT end