Sha256: f2c5912c0aa721d9a41c68795517e1d28f1eb302abbfdd2a45864c3a6dd036fd

Contents?: true

Size: 595 Bytes

Versions: 1

Compression:

Stored size: 595 Bytes

Contents

module Plutonium
  module Helpers
    module FormHelper
      include ActionView::Helpers::FormHelper

      #
      # Override the original form_for helper to disable turbo forms by default if not
      # explicitly opted into
      #
      def resource_form_for(record, options = {}, &block)
        turbo_frame = options.key?(:turbo_frame) ? options[:turbo_frame] : "_top"
        options = {
          html: {
            data: {
              turbo_frame:
            }
          }
        }.deep_merge! options

        simple_form_for(record, options, &block)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
plutonium-0.5.0 lib/plutonium/helpers/form_helper.rb