Vendor Foundation form builder to remove gem dependency
The "foundation_rails_helper" gem is no longer maintained and is incompatible with Rails 7.1. To avoid blocking the upgrade, we've vendored the vendor/foundation_rails_helper/form_builder.rb as a copy of the original FormBuilder class. To mantain compatibility with auto_labels and button_class variables, that are used in the original builder, we are overwriting in the foundation form builder initializer. The gem has been removed from the Gemfile and replaced with this vendored fallback. This workaround is safe to remove once legacy Foundation CSS support is dropped. All vendored code retains the original MIT license and attribution.
This commit is contained in:
16
config/initializers/foundation_form_builder.rb
Normal file
16
config/initializers/foundation_form_builder.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
require Rails.root.join("vendor/foundation_rails_helper/form_builder.rb")
|
||||
|
||||
class FoundationRailsHelper::FormBuilder
|
||||
def column_classes(...)
|
||||
""
|
||||
end
|
||||
|
||||
def auto_labels
|
||||
true
|
||||
end
|
||||
|
||||
def submit(value = nil, options = {})
|
||||
options[:class] ||= "success button"
|
||||
super
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user