Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Simple Form configuration

commit b27c0d2738c6b7c63bf23d0afbb0fc5c7546b7ad 1 parent e03b68b
@rafaelfranca authored
View
8 app/views/examples/_basic_example_sf.html.erb
@@ -1,10 +1,4 @@
-<%= simple_form_for @user_basic, url: create_basic_examples_url, as: 'user_basic',
- wrapper_mappings: {
- check_boxes: :vertical_radio_and_checkboxes,
- radio_buttons: :vertical_radio_and_checkboxes,
- file: :vertical_file_input,
- boolean: :vertical_boolean
- } do |f| %>
+<%= simple_form_for @user_basic, url: create_basic_examples_url, as: 'user_basic' do |f| %>
<%= f.error_notification %>
<%= f.input :email, placeholder: 'Enter email' %>
View
5 app/views/examples/_inline_form_sf.html.erb
@@ -1,9 +1,6 @@
<%= simple_form_for @user_inline, url: create_inline_examples_url, as: 'user_inline',
wrapper: :inline_form,
- html: { class: 'form-inline' },
- wrapper_mappings: {
- boolean: :vertical_boolean
- } do |f| %>
+ html: { class: 'form-inline' } do |f| %>
<%= f.error_notification %>
<%= f.input :email, placeholder: 'Enter email' %>
View
13 config/initializers/simple_form.rb
@@ -22,9 +22,9 @@
b.use :placeholder
## Optional extensions
- # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
+ # They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
- # if any exists. If you want to enable the lookup for any of those
+ # if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
@@ -103,8 +103,9 @@
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
- # You can define the class to use on all forms. Default is simple_form.
- # config.form_class = :simple_form
+ # You can define the default class to be used on forms. Can be overriden
+ # with `html: { :class }`. Defaulting to none.
+ # config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
@@ -131,6 +132,10 @@
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
+ # Namespaces where SimpleForm should look for custom input classes that
+ # override default inputs.
+ # config.custom_inputs_namespaces << "CustomInputs"
+
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
View
6 config/initializers/simple_form_bootstrap.rb
@@ -127,4 +127,10 @@
# to learn about the different styles for forms and inputs,
# buttons and other elements.
config.default_wrapper = :vertical_form
+ config.wrapper_mappings = {
+ check_boxes: :vertical_radio_and_checkboxes,
+ radio_buttons: :vertical_radio_and_checkboxes,
+ file: :vertical_file_input,
+ boolean: :vertical_boolean,
+ }
end
Please sign in to comment.
Something went wrong with that request. Please try again.