Skip to content

Instantly share code, notes, and snippets.

@mediasota
Created March 6, 2015 12:04
Show Gist options
  • Save mediasota/7c46c8e105acc386d62f to your computer and use it in GitHub Desktop.
Save mediasota/7c46c8e105acc386d62f to your computer and use it in GitHub Desktop.
config/initializers/simple_form_materialize-sass.rb
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.error_notification_class = 'alert alert-danger'
config.button_class = 'waves-effect waves-light btn'
config.boolean_label_class = nil
config.wrappers :vertical_form, tag: 'div', class: 'input-field', error_class: 'has-error' do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :min_max
b.optional :readonly
b.use :input
b.use :label
b.use :error, wrap_with: { tag: 'span', class: 'error-block' }
b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
end
config.wrappers :vertical_boolean, tag: 'p', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.use :input
b.use :label
b.use :error, wrap_with: { tag: 'span', class: 'error-block' }
b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
end
config.wrappers :vertical_radio_and_checkboxes, tag: 'p', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.use :input
b.use :label
b.use :error, wrap_with: { tag: 'span', class: 'error-block' }
b.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment