Module: Bh::Rails::Helpers

Includes:
ActionView::Helpers::FormHelper
Defined in:
lib/bh/core_ext/rails/form_for_helper.rb

Instance Method Summary collapse

Instance Method Details

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



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bh/core_ext/rails/form_for_helper.rb', line 10

def form_for(record, options = {}, &block)
  options[:layout] ||= 'navbar' if Bh::Stack.find(Bh::Navbar)
  add_form_options!(options) if options[:layout]
  html = super record, options, &block

  if Bh::Stack.find(Bh::Nav)
    container = Bh::Base.new(self) { html }
    container.render_tag :li
  else
    html
  end
end