bootstrap-sass extras, idea and codes from twitter-bootstrap-rails
Add this line to your application's Gemfile:
gem 'bootstrap-sass-extras'
And then execute:
$ bundle
Or install it yourself as:
$ gem install bootstrap-sass-extras
You can run following generators to get started with Twitter Bootstrap quickly.
Generate locale
Usage:
rails g bootstrap:install
Layout (generates Twitter Bootstrap compatible layout) - (Haml and Slim supported)
Usage:
rails g bootstrap:layout [LAYOUT_NAME] [*fixed or fluid]
Example of a fixed layout:
rails g bootstrap:layout application fixed
Example of a responsive layout:
rails g bootstrap:layout application fluid
Themed (generates Twitter Bootstrap compatible scaffold views.) - (Haml and Slim supported)
Usage:
rails g bootstrap:themed [RESOURCE_NAME]
Example:
rails g scaffold Post title:string description:text
rake db:migrate
rails g bootstrap:themed Posts
Notice the plural usage of the resource to generate bootstrap:themed.
Add flash helper <%= bootstrap_flash %>
to your layout (built-in with layout generator)
You can create modals easily using the following example. The header, body, and footer all accept content_tag or plain html. The href of the button to launch the modal must matche the id of the modal dialog.
<%= content_tag :a, "Modal", :href => "#modal", :class => 'btn', :data => {:toggle => modal'} %>
<%= modal_dialog :id => "modal",
:header => { :show_close => true, :dismiss => 'modal', :title => 'Modal header' },
:body => 'This is the body',
:footer => content_tag(:button, 'Save', :class => 'btn') %>
Notice If your application is using breadcrumbs-on-rails you will have a namespace collision with the add_breadcrumb method. You do not need to use these breadcrumb gems since this gem provides the same functionality out of the box without the additional dependency.
Add breadcrumbs helper <%= render_breadcrumbs %>
to your layout.
class ApplicationController
add_breadcrumb :index, :root_path
end
class ExamplesController < ApplicationController
add_breadcrumb :index, :examples_path
def index
end
def show
@example = Example.find params[:id]
add_breadcrumb @example.name, example_path(@example)
# add_breadcrumb :show, example_path(@example)
end
end
glyph(:share_alt)
# => <i class="icon-share-alt"></i>
glyph(:lock, :white)
# => <i class="icon-lock icon-white"></i>
- Fork it
- 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 new Pull Request