Forked from anonymous/simple_form_mdl_wrappers.rb
Last active
November 8, 2016 02:42
-
-
Save t4sk/7a99f6695f68a71d0926e255b1e0249d to your computer and use it in GitHub Desktop.
Material Design Lite (v 1.2.1) wrappers for Simple Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple wrappers for Material Design Lite text fields to use with SimpleForm (Rails) | |
SimpleForm.setup do |config| | |
config.wrappers :mdl_field, tag: 'div', class: 'mdl-textfield mdl-js-textfield', error_class: 'is-invalid' do |b| | |
b.use :html5 | |
b.use :input, class: 'mdl-textfield__input' | |
b.use :label, class: 'mdl-textfield__label' | |
b.use :error, wrap_with: { tag: :span, class: "mdl-textfield__error" } | |
end | |
config.wrappers :mdl_field_floating, tag: 'div', class: 'mdl-textfield mdl-js-textfield mdl-textfield--floating-label', error_class: 'is-invalid' do |b| | |
b.use :html5 | |
b.use :input, class: 'mdl-textfield__input' | |
b.use :label, class: 'mdl-textfield__label' | |
b.use :error, wrap_with: { tag: :span, class: "mdl-textfield__error" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment