twitter bootstrap on rails

22
Twitter Bootstrap on Rails 2011.12.07 Hamamatsu.rb #10 @mackato

Upload: masakuni-kato

Post on 15-Jan-2015

11.612 views

Category:

Technology


3 download

DESCRIPTION

Twitter BootstrapをRailsで便利に使う説明&デモです。 2011.12.07 Hamamatsu.rb #10 @mackato

TRANSCRIPT

Page 1: Twitter bootstrap on rails

Twitter Bootstrap on Rails2011.12.07 Hamamatsu.rb #10 @mackato

Page 2: Twitter bootstrap on rails

I’m a programmer,not a web designer.

@mackato

Page 3: Twitter bootstrap on rails

Programmer’s web design

Page 4: Twitter bootstrap on rails

Programmer’s web design

Page 5: Twitter bootstrap on rails

Bootstrap, from TwitterBootstrap is a toolkit from Twitter designed to kickstart

development of webapps and sites.It includes base CSS and HTML for typography, forms,

buttons, tables, grids, navigation, and more.

http://twitter.github.com/bootstrap/

Page 6: Twitter bootstrap on rails

Layouts

Fixed Fluid

Page 7: Twitter bootstrap on rails

Typography

Page 8: Twitter bootstrap on rails

Tables

Page 9: Twitter bootstrap on rails

Forms

Page 10: Twitter bootstrap on rails

Navigation

Page 11: Twitter bootstrap on rails

Alerts

Page 12: Twitter bootstrap on rails

Popovers

Page 13: Twitter bootstrap on rails

Twitter Bootstrap for Railshttps://github.com/seyhunak/twitter-bootstrap-rails

Gemfilegem 'twitter-bootstrap-rails'

% bundle install % rails generate bootstrap:install

Page 14: Twitter bootstrap on rails

Twitter Bootstrap for Railsapp/assets/javascripts/application.js

app/assets/stylesheets/application.css *= require_self *= require twitter/bootstrap *= require_tree .

//= require jquery//= require jquery_ujs//= require twitter/bootstrap//= require_tree .

Page 15: Twitter bootstrap on rails

Markup by Hand <div class="topbar"> <div class="topbar-inner"> <div class="container"> <h3><%= link_to "MyApp", "/" %></h3> <ul class="nav"> <li><%= link_to "Link1", "/path1" %></li> <li><%= link_to "Link2", "/path2" %></li> <li><%= link_to "Link3", "/path3" %></li> </ul> </div> </div> </div>

Page 16: Twitter bootstrap on rails

Markup by Hand

bored!!!

<div class="topbar"> <div class="topbar-inner"> <div class="container"> <h3><%= link_to "MyApp", "/" %></h3> <ul class="nav"> <li><%= link_to "Link1", "/path1" %></li> <li><%= link_to "Link2", "/path2" %></li> <li><%= link_to "Link3", "/path3" %></li> </ul> </div> </div> </div>

Page 17: Twitter bootstrap on rails

Fork it

https://github.com/mackato/twitter-bootstrap-rails

Page 18: Twitter bootstrap on rails

InstallGemfile

% bundle install

gem 'twitter-bootstrap-rails', :git => 'git://github.com/mackato/twitter-bootstrap-rails.git

Page 19: Twitter bootstrap on rails

Layout generator% rails g bootstrap:layout --helpUsage: rails generate bootstrap:layout [LAYOUT_NAME] [*fixed or fluid] [options]

Runtime options: -p, [--pretend] # Run but do not make any changes -s, [--skip] # Skip files that already exist -q, [--quiet] # Supress status output -f, [--force] # Overwrite files that already exist

This generator creates layout file with navigation.

Page 20: Twitter bootstrap on rails

form generator% rails g bootstrap:form --help Usage: rails generate bootstrap:form MODEL_NAME [DIR_NAME] [options]

Runtime options: -p, [--pretend] # Run but do not make any changes -s, [--skip] # Skip files that already exist -q, [--quiet] # Supress status output -f, [--force] # Overwrite files that already exist

This generator creates form partial file for a model.

Page 21: Twitter bootstrap on rails

Demo

Page 22: Twitter bootstrap on rails

Thanks!ToDo: haml and mongoid support.