Permalink
Browse files

Updated documentation

  • Loading branch information...
JackNeto committed Feb 5, 2012
1 parent 677a41d commit ced1a33a7fea602dd5ceaab5145e646080a122e3
Showing with 44 additions and 9 deletions.
  1. +43 −8 README.md
  2. +1 −1 bootstrap_builder.gemspec
View
@@ -1,28 +1,63 @@
-# Rails Bootstrap Builder
+# Bootstrap Builder
Author: [The Working Group](http://www.theworkinggroup.ca)
---
## What is it?
-A Rails form builder to simplify your forms and keep your views clean.
-
-
+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 'rails-bootstrap-builder'
+ gem 'bootstrap_builder'
Then from the Rails project's root run:
bundle install
## Usage (with haml)
- = bootstrap_form_for @session_user, :url => login_path do |f|
- = f.text_field :email, :label => 'Email address'
+### 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', :change_to_text => 'Logging you in ...', :image => true
+ = 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)*
+
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Jack Neto", "The Working Group Inc."]
- s.date = "2012-02-04"
+ s.date = "2012-02-05"
s.description = ""
s.email = "jack@twg.ca"
s.extra_rdoc_files = [

0 comments on commit ced1a33

Please sign in to comment.