Sha256: 56de615d532529b9ff52528f7d3561a54ac1f026052cbc607d0a31cedcb59605

Contents?: true

Size: 1.73 KB

Versions: 3

Compression:

Stored size: 1.73 KB

Contents

# Bootstrap Builder

A Rails form builder that generates [Twitter Bootstrap](http://twitter.github.com/bootstrap) markup and helps keep your code clean.

* Uses existing Rails helpers
* Autogenerates labels


## Installation

Add gem definition to your Gemfile:
    
    gem 'bootstrap_builder'
    
Then from the Rails project's root run:
    
    bundle install
    
## Usage (with haml)

### A sample user form

Override  the autogenerated label by using the `:label` option on any element

    = bootstrap_form_for @user, :url => [:admin, @user] do |f|
      = f.text_field :name
      = f.text_field :email
      = f.password_field :password
      = f.password_field :password_confirmation
      = f.select :role, User::ROLES
      = f.time_zone_select :time_zone
      = f.check_box :reminder, :label => 'Send Daily Reminder?'
      = f.submit 'Save'

### A login form

Add a class to the form or any field to change the way it is rendered.

    = bootstrap_form_for @session_user, :url => login_path, :class => 'form-horizontal' do |f|
      = f.text_field :email
      = f.password_field :password
      = f.check_box :remember_me, :label => 'Remember me when I come back'
      = f.submit 'Log In'
  
### A search form

Hide the label by passing `:label => ''` on any field. 

Useful for inline search forms.


    = bootstrap_form_for @search, :url => [:admin, :users], :html => {:method => :get, :class => 'form-search'} do |f|
      = f.text_field :name_equals, :label => 'Find by', :placeholder => 'Name'
      = f.select :role_equals, User::ROLES, :label => ''
      = f.submit 'Search', :class => 'btn-default'

*(Example using [MetaSearch](https://github.com/ernie/meta_search) helpers)*

---

Author: [The Working Group](http://www.theworkinggroup.ca)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bootstrap_builder-0.1.2 README.md
bootstrap_builder-0.1.1 README.md
bootstrap_builder-0.1.0 README.md