Module: Adminterface::Extensions::Views::Components::Tabs

Defined in:
lib/adminterface/extensions/views/components/tabs.rb

Instance Method Summary collapse

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, options, &block)
  fragment = options.fetch(:id, fragmentize(title))
  options = options.reverse_merge(id: fragment, "aria-labelledby": "#{fragment}-tab")
  div(options.merge(tab_pane_options(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 build_menu_item(title, options, &_block)
  fragment = options.fetch(:id, fragmentize(title))
  html_options = options.fetch(:html_options, {})

  li html_options.merge(class: "nav-item", role: "presentation") do
    @http ? link_to_http(title, fragment) : link_to_js(title, fragment)
  end
end

#content_html_optionsObject



31
32
33
34
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 31

def content_html_options
  content_html[:class] = "tab-content #{content_html[:class]}".squish
  content_html
end

#default_css_classObject



21
22
23
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 21

def default_css_class
  tabs_css_classes
end


25
26
27
28
29
# File 'lib/adminterface/extensions/views/components/tabs.rb', line 25

def nav_html_options
  nav_html[:class] = "nav #{default_css_class} #{nav_html[:class]}".squish
  nav_html[:role] = "tablist"
  nav_html
end