-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Zurb's Foundation integration
Instructions for (probably half-baked) Foundation integration (SimpleForm 1.5):
-
Edit
config/initializers/simple_form.rb
at line 59:
Define config.form_class with the following :
config.form_class = :nice
-
Create the file
lib/core_ext/simple_form/inputs/string_input.rb
with the following :SimpleForm::Inputs::StringInput.class_eval do
alias :old_input_html_classes :input_html_classes def input_html_classes super + [:"input-text"] end end
-
Create the file
lib/core_ext/simple_form/inputs/password_input.rb
with the followingSimpleForm::Inputs::PasswordInput.class_eval do
alias :old_input_html_classes :input_html_classes def input_html_classes super + [:"input-text"] end end
-
Make sure your two core_ext files are properly included in your application, either by adding lib/core_ext to the load_path, or by including them manually.
- Putting the files in
autoload_path
inconfig/application.rb
does not work as it tries to load the extensions to the class before the class has been loaded. - Adding the following lines at the end of the
config/initializers/simple_form.rb
workeds:require Rails.root.join("lib/core_ext/simple_form/inputs/string_input")
require Rails.root.join("lib/core_ext/simple_form/inputs/password_input")
- Adding the following line at the end of the above file, will load every customization for simple_form:
Dir[Rails.root.join("lib/core_ext/simple_form/**/*.rb")].each { |f| require f }
This page was created by the OSS community and might be outdated or incomplete. Feel free to improve or update this content according to the latest versions of SimpleForm and Rails to help the next developer who visits this wiki after you.
Keep in mind to maintain the guides as simple as possible and to avoid additional dependencies that might be specific to your application or workflow (such as Haml, RSpec, Guard and similars).