Module: QUI::Toolbar::MainHelper

Defined in:
lib/qui-toolbar-main-helper.rb

Instance Method Summary collapse

Instance Method Details

#toolbar(options = {}, &b) ⇒ Object

Raises:

  • (RuntimeError)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/qui-toolbar-main-helper.rb', line 4

def toolbar(options = {}, &b)
  @toolbar_count ||= 0
  raise RuntimeError, "@toolbar_count must be integer" unless @toolbar_count.is_a? Fixnum

  contents = capture do
    yield QUI::Toolbar::Base.new b.binding
  end
  
  
  options[:html_options] ||= {}
  options[:html_options][:id] ||= "toolbar_#{@toolbar_count}"

  @toolbar_count += 1
  
  concat (:div, contents, options[:html_options].merge({:class => "toolbar"}))
end