add simple form configure
This commit is contained in:
parent
86f4652c8b
commit
7b7c992b7d
|
@ -0,0 +1,19 @@
|
|||
# Use this setup block to configure all options available in SimpleForm.
|
||||
SimpleForm.setup do |config|
|
||||
config.wrappers :default, class: :input,
|
||||
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
|
||||
b.use :html5
|
||||
b.use :placeholder
|
||||
b.use :label_input
|
||||
b.use :hint, wrap_with: { tag: :span, class: :hint }
|
||||
b.use :error, wrap_with: { tag: :span, class: :error }
|
||||
|
||||
end
|
||||
|
||||
config.default_wrapper = :default
|
||||
config.boolean_style = :nested
|
||||
config.button_class = 'button'
|
||||
config.error_notification_tag = :div
|
||||
|
||||
config.error_notification_class = 'error_notification'
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
en:
|
||||
simple_form:
|
||||
"yes": 'Yes'
|
||||
"no": 'No'
|
||||
required:
|
||||
text: 'required'
|
||||
mark: '*'
|
||||
# You can uncomment the line below if you need to overwrite the whole required html.
|
||||
# When using html, text and mark won't be used.
|
||||
# html: '<abbr title="required">*</abbr>'
|
||||
error_notification:
|
||||
default_message: "Please review the problems below:"
|
||||
# Examples
|
||||
# labels:
|
||||
# defaults:
|
||||
# password: 'Password'
|
||||
# user:
|
||||
# new:
|
||||
# email: 'E-mail to sign in.'
|
||||
# edit:
|
||||
# email: 'E-mail.'
|
||||
# hints:
|
||||
# defaults:
|
||||
# username: 'User name to sign in.'
|
||||
# password: 'No special characters, please.'
|
||||
# include_blanks:
|
||||
# defaults:
|
||||
# age: 'Rather not say'
|
||||
# prompts:
|
||||
# defaults:
|
||||
# age: 'Select your age'
|
|
@ -0,0 +1,10 @@
|
|||
= simple_form_for(@<%= singular_table_name %>) do |f|
|
||||
= f.error_notification
|
||||
|
||||
.form-inputs
|
||||
<%- attributes.each do |attribute| -%>
|
||||
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
|
||||
<%- end -%>
|
||||
|
||||
.form-actions
|
||||
= f.button :submit
|
Loading…
Reference in New Issue