Module: SimpleShow::ActionViewExtensions::FormHelper

Defined in:
lib/simple_show/action_view_extensions/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#simple_show_for(record, options = {}, &block) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/simple_show/action_view_extensions/form_helper.rb', line 4

def simple_show_for(record, options = {}, &block)
  raise ArgumentError, "Missing block" unless block_given?

  options[:html] ||= {}
  options[:html][:id] ||= dom_id(record)
  options[:html][:class] = "#{SimpleShow.show_class} #{dom_class(record)} #{options[:html][:class]}".strip

  output = capture(SimpleShow::Base.new(self, record, options), &block)
  output.concat (:div, '', :class => 'clear') if SimpleShow.clear_on_close

  (:div, output, :id => options[:html][:id], :class => options[:html][:class])
end