Sha256: b0056c6b6a25ff2cb9dd84d1dccb759c001ba3e63d9cf600061e35e51a955813
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
require "view_component/form" module Plutonium module Helpers module FormHelper include ActionView::Helpers::FormHelper def resource_form_for(record, options = {}, &block) options[:builder] ||= Plutonium::Ui::FormBuilder options[:wrapper] ||= :default_resource_form options[:html] ||= {} unless options[:html].key?(:novalidate) options[:html][:novalidate] = false end with_resource_form_field_error_proc do form_for(record, options, &block) end end def token_tag(...) # needed to workaround https://github.com/tailwindlabs/tailwindcss/issues/3350 super(...).sub(" />", " hidden />").html_safe end private def with_resource_form_field_error_proc # borrowed from https://github.com/heartcombo/simple_form/blob/main/lib/simple_form/action_view_extensions/form_helper.rb#L40C1-L50C10 # this does not look threadsafe default_field_error_proc = ::ActionView::Base.field_error_proc begin ::ActionView::Base.field_error_proc = proc { |html_tag, instance| html_tag } yield ensure ::ActionView::Base.field_error_proc = default_field_error_proc end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
plutonium-0.8.0 | lib/plutonium/helpers/form_helper.rb |