Rails Form Builders for bootstrap style forms.
Add this line to your application's Gemfile:
gem 'bootstrap_form_builder'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bootstrap_form_builder
Currently only supports horizontal forms.
To use, pass the builder class into the form_for
method in a Rails form and set the
form-horizontal
class on the form element:
<%= form_for(resource,
:builder => BootstrapFormBuilder::HorizontalFormBuilder,
:html => { :class => 'form-horizontal' }) do |f| %>
Then calling the usual form field methods will generate labels and form elements confirming to the Bootstrap markup. If there are errors on the object these will also be output using Bootstrap Validation States.
- Fork it ( https://github.com/[my-github-username]/bootstrap_form_builder/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request