I found it is very powerful to use when you try to build a data-binding form.
Installation
gem 'bootstrap_form'
Note that there are "bootstrap-form" and "bootstrap_forms" gems, so don't make mistake!
Here's a quick example you can start up with:
The magic of BootstrapFrom is as this screen slice below shows:Here's a quick example you can start up with:
<%= bootstrap_form_for(@user, html: { class: 'form-horizontal' }, help: :block) do |f| %>
<%= f.alert_message "Please fix the errors below." %>
<%= f.text_field :twitter_username, prepend: '@', label: 'Twitter' %>
<%= f.text_field :email %>
<%= f.password_field :password, help: 'Must be at least 6 characters long' %>
<%= f.password_field :password_confirmation, label: 'Confirm Password' %>
<%= f.control_group :terms do %>
<%= f.check_box :terms, label: 'I agree to the Terms of Service' %>
<% end %>
<%= f.actions do %>
<%= f.primary 'Create My Account', disable_with: 'Saving...' %>
<% end %>
<% end %>
If there are errors, they will be shown just aside or below the input box. An error notice is also shown as well. It's a really nice feature.
Just a note for it!
Just a note for it!
No comments:
Post a Comment