Sha256: ce31ebd373eed03b9688fe2bcd4c5901dc3e29dcdc4810910aa3068723fb93ac
Contents?: true
Size: 961 Bytes
Versions: 116
Compression:
Stored size: 961 Bytes
Contents
# frozen_string_literal: true module Ariadne module ActionViewExtensions # :nodoc: module FormHelper include ClassNameHelper DEFAULT_FORM_CLASSES = "ariadne-space-y-8 sm:ariadne-space-y-5" def ariadne_form_with(model: nil, scope: nil, url: nil, format: nil, classes: "", attributes: {}, **options, &block) options[:class] = merge_class_names(DEFAULT_FORM_CLASSES, options[:class]) options[:builder] ||= Ariadne::FormBuilder options[:html] = attributes data_controller = options[:html].fetch(:"data-controller", "") options[:html][:"data-controller"] = if data_controller.present? "#{data_controller} ariadne-form" else "ariadne-form" end form_with(model: model, scope: scope, url: url, format: format, **options, &block) end end end end ActiveSupport.on_load(:action_view) do include Ariadne::ActionViewExtensions::FormHelper end
Version data entries
116 entries across 116 versions & 1 rubygems