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(options) ⇒ 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(options) ⇒ Object
14 15 16 17 |
# File 'lib/toolsmith/views/page_header.rb', line 14 def () [:title, :icon, :path].each { |param| missing_parameter(param, ) } << end |
#button_markup(options) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/toolsmith/views/page_header.rb', line 19 def () = .fetch(:anchor, {}) context.link_to [:path], .merge(class: "btn"), title: [:title] do content_tag :i, "", class: "icon-#{[:icon]}" end end |
#buttons ⇒ Object
26 27 28 |
# File 'lib/toolsmith/views/page_header.rb', line 26 def @buttons ||= [] end |
#full_title ⇒ Object
30 31 32 |
# File 'lib/toolsmith/views/page_header.rb', line 30 def full_title subtitle ? "#{ERB::Util.h(title)} #{content_tag(:small, self.subtitle)}".html_safe : ERB::Util.h(title) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/toolsmith/views/page_header.rb', line 34 def to_s content_tag :div, h1_tag, class: "page-header" end |