Class: TabMenu::TabBuilder
- Inherits:
-
Object
- Object
- TabMenu::TabBuilder
- Includes:
- ActionView::Helpers::CaptureHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/tab_menu/tab_builder.rb
Instance Attribute Summary collapse
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
Instance Method Summary collapse
-
#initialize(controller, current_tab = nil) ⇒ TabBuilder
constructor
A new instance of TabBuilder.
- #tab(name, url, li_html_options = {}, link_to_options = {}) ⇒ Object
Constructor Details
#initialize(controller, current_tab = nil) ⇒ TabBuilder
Returns a new instance of TabBuilder.
7 8 9 10 |
# File 'lib/tab_menu/tab_builder.rb', line 7 def initialize(controller, current_tab = nil) @controller = controller @current_tab = current_tab end |
Instance Attribute Details
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
6 7 8 |
# File 'lib/tab_menu/tab_builder.rb', line 6 def output_buffer @output_buffer end |
Instance Method Details
#tab(name, url, li_html_options = {}, link_to_options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tab_menu/tab_builder.rb', line 12 def tab(name, url, = {}, = {}) #append current to the contentli class attribute if its the current page if (!@current_tab.nil? && @current_tab.downcase == name.downcase) || (@current_tab.nil? && @controller.current_page?(url)) [:class] = [[:class], configuration.active_class].join(" ").strip() end content_tag(:li, name, ) do @controller.link_to name, url, end end |