Module: TabBuilder::Drawer

Defined in:
lib/tab_builder/drawer.rb

Class Method Summary collapse

Class Method Details

.draw(tabset, context, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tab_builder/drawer.rb', line 3

def self.draw(tabset, context, &block)
  @context = context
  
  content_for :style do
    stylesheet_link_tag 'tab_builder'
  end
  
  out = ActiveSupport::SafeBuffer.new
  out << render(partial: 'tab_builder/tab_strip', locals: { tabs: tabset })
        
  out << (:div, :class => "tab_content") do
    (:div, :class => 'tab_content_inner') { @context.capture(&block) }
  end if block_given?

  out
end

.method_missing(name, *args, &block) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/tab_builder/drawer.rb', line 20

def self.method_missing(name, *args, &block)
  # Pass methods along to the context, if it responds to them (allows for helpers, etc. to be used):
  if @context.respond_to? name
    @context.send(name, *args, &block)
  else
    super(name, *args, &block)
  end
end