Sha256: df6c19078497e4de192119063d8e28464d2fd52cfb98adb4243244e7d914fe6f
Contents?: true
Size: 833 Bytes
Versions: 2
Compression:
Stored size: 833 Bytes
Contents
module Trestle module FormHelper def trestle_form_for(instance, options={}, &block) options[:builder] ||= Form::Builder options[:as] ||= admin.admin_name.singularize options[:data] ||= {} options[:data].merge!(remote: true, type: :html, behavior: "trestle-form", turbolinks: false) form_for(instance, options) do |f| with_form(f) { yield f } end end def with_form(form) @_trestle_form = form yield form if block_given? ensure @_trestle_form = nil end def form @_trestle_form end def toolbar(name, &block) content_for(:"#{name}_toolbar", &block) end def sidebar(&block) content_for(:sidebar, &block) end def render_sidebar_as_tab? dialog_request? && content_for?(:sidebar) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.7 | app/helpers/trestle/form_helper.rb |
trestle-0.8.6 | app/helpers/trestle/form_helper.rb |