Class: ActiveAdmin::Views::Tabs
- Defined in:
- lib/active_admin/views/components/tabs.rb
Instance Method Summary collapse
- #build(&block) ⇒ Object
- #build_content_item(title, options, &block) ⇒ Object
- #build_menu_item(title, options, &block) ⇒ Object
- #tab(title, options = {}, &block) ⇒ Object
Instance Method Details
#build(&block) ⇒ Object
12 13 14 15 |
# File 'lib/active_admin/views/components/tabs.rb', line 12 def build(&block) @menu = ul(class: 'nav nav-tabs', role: "tablist") @tabs_content = div(class: 'tab-content') end |
#build_content_item(title, options, &block) ⇒ Object
26 27 28 29 |
# File 'lib/active_admin/views/components/tabs.rb', line 26 def build_content_item(title, , &block) = .reverse_merge(id: fragmentize(title)) div(, &block) end |
#build_menu_item(title, options, &block) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/active_admin/views/components/tabs.rb', line 17 def (title, , &block) fragment = .fetch(:id, fragmentize(title)) = .fetch(:html_options, {}) li do link_to title, "##{fragment}" end end |
#tab(title, options = {}, &block) ⇒ Object
6 7 8 9 10 |
# File 'lib/active_admin/views/components/tabs.rb', line 6 def tab(title, = {}, &block) title = title.to_s.titleize if title.is_a? Symbol @menu << (title, , &block) @tabs_content << build_content_item(title, , &block) end |