class PostRunner::NavButtonRow::Button
A class to store the icon and URL of a button in the NavButtonRow
objects.
Public Class Methods
new(icon, url = nil)
click to toggle source
Create a Button
object. @param icon [String] File name of the icon file @param url [String] URL of the page to change to
# File lib/postrunner/NavButtonRow.rb, line 32 def initialize(icon, url = nil) @icon = icon @url = url end
Public Instance Methods
to_html(doc)
click to toggle source
Add the object as HTML Elements to the document. @param doc [HTMLBuilder] XML Document
# File lib/postrunner/NavButtonRow.rb, line 39 def to_html(doc) if @url doc.a({ :href => @url }) { doc.img({ :src => "icons/#{@icon}", :class => 'active_button' }) } else doc.img({ :src => "icons/#{@icon}", :class => 'inactive_button' }) end end