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
19 20 21 22 23 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 19 def build_content_item(title, , &block) fragment = .fetch(:id, fragmentize(title)) = .reverse_merge(id: fragmentize(title)) div(.merge(class: tab_pane_class(fragment)), &block) end |
#build_menu_item(title, options, &_block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# 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") do if @http params[:tab] ||= @default_tab || fragment link_to title, url_for(tab: fragment, anchor: id, anchor_id: id), class: toggler_class(fragment) else link_to title, "##{fragment}", class: toggler_class(fragment), data: {"bs-toggle": "tab", "bs-target": "##{fragment}"} end end end |
#content_html_options ⇒ Object
35 36 37 38 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 35 def content_html[:class] = "tab-content #{content_html[:class]}".squish content_html end |
#default_css_class ⇒ Object
25 26 27 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 25 def default_css_class tabs_css_classes end |
#nav_html_options ⇒ Object
29 30 31 32 33 |
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 29 def nav_html[:class] = "nav #{default_css_class} #{nav_html[:class]}".squish nav_html[:role] = "tablist" nav_html end |