Module: Railsstrap::Rails::Helpers

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

Instance Method Summary collapse

Instance Method Details

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



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/railsstrap/core_ext/rails/form_for_helper.rb', line 12

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

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