Module: PagesCore::Admin::ContentTabsHelper

Included in:
AdminHelper
Defined in:
app/helpers/pages_core/admin/content_tabs_helper.rb

Instance Method Summary collapse

Instance Method Details

#content_tab(name, options = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/helpers/pages_core/admin/content_tabs_helper.rb', line 6

def content_tab(name, options = {}, &block)
  @content_tabs ||= []
  return unless block_given?

  tab = {
    name: name.to_s.humanize,
    key: options[:key] || name.to_s.underscore.gsub(/\s+/, "_"),
    options: options,
    content: capture(&block)
  }
  @content_tabs << tab
  content_tab_tag(tab[:key], tab[:content])
end