Sha256: d32ff9052eff817b378119e465103243bff4e7c50558dba978b7a213d279b813

Contents?: true

Size: 839 Bytes

Versions: 31

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

module Ariadne
  module ActionViewExtensions
    # :nodoc:
    module FormHelper
      include ClassNameHelper

      DEFAULT_FORM_CLASSES = "space-y-8 divide-y divide-gray-200 sm:space-y-5"
      def ariadne_form_with(model: nil, scope: nil, url: nil, format: nil, classes: {}, attributes: {}, **options, &block)
        options[:class] = class_names(DEFAULT_FORM_CLASSES, options[:class])
        options[:builder] ||= Ariadne::FormBuilder
        options[:html] ||= {}
        options = options.merge(attributes)
        data = {
          controller: "ariadne-form",
        }
        form_with(model: model, scope: scope, url: url, format: format, data: data, **options, &block)
      end
    end
  end
end

ActiveSupport.on_load(:action_view) do
  include Ariadne::ActionViewExtensions::FormHelper
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.13 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-x86_64-linux app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-x86_64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-x64-mingw32 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-x64-mingw-ucrt app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-arm64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.13-aarch64-linux app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-x86_64-linux app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-x86_64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-x64-mingw32 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-x64-mingw-ucrt app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-arm64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.12-aarch64-linux app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11-x86_64-linux app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11-x86_64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11-x64-mingw32 app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11-x64-mingw-ucrt app/lib/ariadne/action_view_extensions/form_helper.rb
ariadne_view_components-0.0.11-arm64-darwin app/lib/ariadne/action_view_extensions/form_helper.rb