Class: Toolsmith::Views::PageHeader
- Defined in:
- lib/toolsmith/views/page_header.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes inherited from Base
Instance Method Summary collapse
- #button(*args) ⇒ Object
- #button_markup(options) ⇒ Object
- #buttons ⇒ Object
- #full_title ⇒ Object
-
#initialize(context, title, *args) ⇒ PageHeader
constructor
A new instance of PageHeader.
- #to_s ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(context, title, *args) ⇒ PageHeader
Returns a new instance of PageHeader.
6 7 8 9 10 11 12 |
# File 'lib/toolsmith/views/page_header.rb', line 6 def initialize(context, title, *args) super(context) @options = args. @title = title @subtitle = args.first end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/toolsmith/views/page_header.rb', line 4 def @options end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
4 5 6 |
# File 'lib/toolsmith/views/page_header.rb', line 4 def subtitle @subtitle end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/toolsmith/views/page_header.rb', line 4 def title @title end |
Instance Method Details
#button(*args) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/toolsmith/views/page_header.rb', line 14 def (*args) = args.size >= 3 ? (*args) : args.shift << end |
#button_markup(options) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/toolsmith/views/page_header.rb', line 21 def () = .fetch(:anchor, {}) context.link_to [:path], .merge(class: "btn", title: [:title]) do content_tag :i, "", class: "icon-#{[:icon]}" end end |
#buttons ⇒ Object
28 29 30 |
# File 'lib/toolsmith/views/page_header.rb', line 28 def @buttons ||= [] end |
#full_title ⇒ Object
32 33 34 |
# File 'lib/toolsmith/views/page_header.rb', line 32 def full_title subtitle ? "#{ERB::Util.h(title)} #{content_tag(:small, self.subtitle)}".html_safe : ERB::Util.h(title) end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/toolsmith/views/page_header.rb', line 36 def to_s content_tag :div, h1_tag, class: "page-header" end |