Sha256: baefff55a1423113cacee2e6d739d50e452634acf38fbf8867708b68c1b207a3
Contents?: true
Size: 771 Bytes
Versions: 3
Compression:
Stored size: 771 Bytes
Contents
module BootstrapForm module Helper def bootstrap_form_for(object, options = {}, &block) options[:builder] = BootstrapForm::FormBuilder # add .form-vertical class if it's not horizontal options[:html] = {} unless options.has_key?(:html) css = options[:html].fetch(:class, '') options[:html][:class] = "#{css} form-vertical" unless css.match /horizontal/ temporarily_disable_field_error_proc do form_for(object, options, &block) end end def temporarily_disable_field_error_proc original_proc = ActionView::Base.field_error_proc ActionView::Base.field_error_proc = proc { |input, instance| input } yield ensure ActionView::Base.field_error_proc = original_proc end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_form-0.1.3 | lib/bootstrap_form/helper.rb |
bootstrap_form-0.1.2 | lib/bootstrap_form/helper.rb |
bootstrap_form-0.1.1 | lib/bootstrap_form/helper.rb |