Module: Adminterface::Extensions::Views::Components::Tabs
- Defined in:
- lib/adminterface/extensions/views/components/tabs.rb
Instance Method Summary collapse
- #build_content_item(title, options, &block) ⇒ Object
- #build_menu_item(title, options, &_block) ⇒ Object
- #content_html_options ⇒ Object
- #default_css_class ⇒ Object
- #nav_html_options ⇒ Object
Instance Method Details
#build_content_item(title, options, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 15 def build_content_item(title, , &block) fragment = .fetch(:id, fragmentize(title)) = .reverse_merge(id: fragment, "aria-labelledby": "#{fragment}-tab") div(.merge((fragment)), &block) end |
#build_menu_item(title, options, &_block) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 6 def (title, , &_block) fragment = .fetch(:id, fragmentize(title)) = .fetch(:html_options, {}) li .merge(class: "nav-item", role: "presentation") do @http ? link_to_http(title, fragment) : link_to_js(title, fragment) end end |
#content_html_options ⇒ Object
31 32 33 34 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 31 def content_html[:class] = "tab-content #{content_html[:class]}".squish content_html end |
#default_css_class ⇒ Object
21 22 23 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 21 def default_css_class tabs_css_classes end |
#nav_html_options ⇒ Object
25 26 27 28 29 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 25 def nav_html[:class] = "nav #{default_css_class} #{nav_html[:class]}".squish nav_html[:role] = "tablist" nav_html end |