Sha256: 22ccfc5db6248452ba1e788119379064b9b14da3c9a1e852220190ddc3d2e658
Contents?: true
Size: 955 Bytes
Versions: 6
Compression:
Stored size: 955 Bytes
Contents
module EffectiveFormBuilderHelper def effective_form_with(**options, &block) options[:class] = [options[:class], 'needs-validation', ('form-inline' if options[:layout] == :inline)].compact.join(' ') options[:html] = (options[:html] || {}).merge(novalidate: true, onsubmit: 'return EffectiveBootstrap.validate(this);') if options.delete(:remote) == true if options[:html][:data].kind_of?(Hash) options[:html][:data][:remote] = true else options[:html]['data-remote'] = true end end without_error_proc do form_with(**options.merge(builder: Effective::FormBuilder), &block) end end private # Disables a .fields_with_errors wrapping div when def without_error_proc original = ActionView::Base.field_error_proc begin ActionView::Base.field_error_proc = proc { |input, _| input }; yield ensure ActionView::Base.field_error_proc = original end end end
Version data entries
6 entries across 6 versions & 1 rubygems