Sha256: dea7e9365e7d6e8f27aa42a3443c1496ad2d4f8b291d5bca5b6ef04500c114c2

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

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

---

## What is it?

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)*

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap_builder-0.0.0 README.md