• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    Ruby
  • Created almost 13 years ago
  • Updated almost 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Twitter Bootstrap Helper for Rails, support will_paginate & simple_form template

Twitter Bootstrap Helper for Rails 3

Bootstrap 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.

bootstrap_helper auto generates Bootstrap HTML codes.

Rails 3.1

include Bootstrap Helper in Gemfile;

gem 'bootstrap_helper', '3.2.2.0'

Rails 4.0+

or you can install from latest build;

gem 'bootstrap_helper', '4.2.2.1'

USAGE

render_page_title

SETUP

edit your config/application.rb

SITE_NAME = "YOUR SITE NAME"

in application.html.erb, replace <title> with

<%= render_page_title %> 

define page title in your action

def index
  @page_title = "Posts Index"
end

will render

<title>Posts Index | YOUR SITE NAME</title>

render_list

render_list generates ul & li, auto append: "first", "last" class . If link matches current controller and acttion, it will auto add "active" class. Perfact for "menu"

<%= render_list :class => "nav" do |li|
     li << link_to(t("menu.topics"), topics_path)
     li << link_to(t("menu.wiki"), wikis_path )
     li << link_to(t("menu.sites"), sites_path )
     li << link_to(t("menu.users"), users_path)
end %>

render_body_tag

in application.html.erb, replace <body> with

<%= render_body_tag %> 

render_body_tag auto inserts "controller name" & "action name" in to body class, and generates ๏ฟฝIE conditional comment.

<!--[if lt IE 7 ]>
<body class="topics-controller index-action ie6"><![endif]-->
<!--[if gte IE 7 ]>
<body class="topics-controller index-action ie"><![endif]-->
<!--[if !IE]>-->
<body class="topics-controller index-action">
<!--<![endif]-->

breadcrumb

in application.html.erb, place this helper

<%= render_breadcrumb %>

drop breadcrumb in your action

def show
  @post = Posts.find(params[:id])
  drop_breadcrumb("Posts", posts_path)
  drop_breadcrumb(@post.title)
end

it will generate breadcrumb with link for you

Home / Post / YourPostTitle

notice_message

in application.html.erb, place this helper

<%= notice_message %>

write notice message in your action, will generate bootstrap style notice message

def create
  # โ€ฆ.
  redirect_to posts_path, :notice => "Create Success!"
end

def update
  redirect_to root_path, :flash => { :warning => "Update Success!" }
end
def no_permission
  redirect_to root_path, :flash => { :error => "no permission" }
end

Pagination

Support will_paginate, ~> 3.0.3

Markup Example

see example

Other

Form

Support simple_form, ~> 2.0.2

You can use simple_form 2.0 with bootstrap form template

<%= simple_form_for @article do |f| %>
   <%= f.input :title, :input_html => {:class => "xxlarge"} , :hint => "this is post title" %>
<% end >

Thanks

Thanks Twitter for Bootstrap http://twitter.github.com/bootstrap

Thanks Handlino for HandicraftHelper https://github.com/handlino/handicraft_helper

License

Copyright (C) 2011 by xdite

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

learn-hack

ๆ‰“้€ ่ถ…ไบบๅญธ็ฟ’
1,487
star
2

internet-security

ไบ’่”็ฝ‘่ต„ๅฎ‰้ฃŽๆŽงๅฎžๆˆ˜
Makefile
482
star
3

memory-hack

ๆ‰“้€ ่ถ…ไบบๅคง่„‘
Makefile
465
star
4

note-hack

ๆ‰“้€ ่ถ…ไบบ็ญ†่จ˜
Python
368
star
5

bootstrappers

Bootstrappers is the base Rails application using Bootstrap template and other goodies.
Ruby
313
star
6

mind-hack

ๆ‰“้€ ่ถ…ไบบๆ€็ถญ
Ruby
263
star
7

blitz-product

้–ƒ้›ปๅผ้–‹็™ผ
Ruby
251
star
8

growth-hack-resource

Growth Hack ๅ…ฅ้–€ๆŒ‡ๅ— - ็”ขๅ“ๆˆ้•ท็š„ๆ‰“ๅบ•็ง˜็ฌˆ
165
star
9

remote-work

้ ่ทๅทฅไฝœ้€™ๆจฃๅš
Makefile
157
star
10

speed-writing

ๆฅต้€Ÿๅฏซไฝœๆณ•, ๆฅต้€Ÿๅฏซๆ›ธๆณ•
Makefile
105
star
11

value-investing-newbie

Makefile
101
star
12

career-path-book

ๅทฅ็จ‹ๅธซ็”Ÿๆถฏๅฏถๅ…ธ
96
star
13

66kjobs

66K ้ซ˜่–ช็ถฒ
Ruby
91
star
14

rails-101

89
star
15

reading-system

ๅฟซ้€Ÿ่ฏปไนฆ็ณป็ปŸ--ๆ–นๆณ•ไธŽๅทฅๅ…ท
Makefile
51
star
16

buy-time

่Šฑ้’ฑไนฐๆ—ถ้—ด็š„็ณป็ปŸๆ€งไฝœๆณ•
46
star
17

ray-principles

39
star
18

groupme

Ruby
22
star
19

Video2PDF

Python
21
star
20

high-retention-class

้ซ˜็•™ๅญ˜่ชฒๅ ‚ๅฏฆๆˆฐ
Ruby
20
star
21

bootcolor

Auto Generate Color for Bootstrap
Ruby
18
star
22

facebook_connect_demo_application

facebook_connect_demo_application
Ruby
17
star
23

value-investing

16
star
24

essential-rails-pattern

RubyConf TW 2011 Talk of xdite
Ruby
15
star
25

performance-guide

Ruby
15
star
26

value-investing-book

Makefile
15
star
27

fast_random

Ultra Fast ORDER BY RAND solution
Ruby
14
star
28

plurk

Unofficial API for plurk.com
Ruby
14
star
29

openid_pack

restuful_authenication + openid
Ruby
13
star
30

tx_translate

Ruby
13
star
31

jiaoxue

็ฆๅ“ฅ็š„ๆ•™ๅญฆๆŠ€ๆœฏ่ฏ•ๆŽ’็‰ˆ
Makefile
12
star
32

auto-facebook

auto mount omniauth-facebook
Ruby
11
star
33

kaike

10
star
34

intro-growth-hack

GrowthHack ้€™ๆจฃๅš
Ruby
9
star
35

engineer-career

Makefile
7
star
36

novel-crawler

The bot will crawl novel , chapter by chapter , and pack it to RTF / TXT format
Ruby
7
star
37

plurker

Based on Official Plurk API , Rails Plugin .
6
star
38

forum_demo

Ruby
6
star
39

adv-growth-hack

Makefile
6
star
40

twitter-message-wall

twitter-message-wall
5
star
41

deliberate-practice

Makefile
5
star
42

asiasearch

Yahoo Asia Search
Ruby
5
star
43

fumao-text

ๅไบ”ๅ ดๆœ่ฒฟๅ…ฌ่ฝๆœƒ้€ๅญ—็จฟ๏ผˆ่ซ‹ Fork ๅ”ๅŠฉๆŽ’็‰ˆ๏ผ‰
5
star
44

web-app-basic

JavaScript
5
star
45

video2blog

Python
4
star
46

tx_nlp

Ruby
4
star
47

yiban

Ruby
4
star
48

yahoobb-pack

Openid_pack with yahoo_bb auth
Ruby
4
star
49

css-design-rules

css-design-rules
4
star
50

markdown-filepicker

atom package for inline uploading image
CoffeeScript
4
star
51

roe-decode

Makefile
4
star
52

advacned-patterns

4
star
53

gszgz

4
star
54

twsms

Ruby
3
star
55

slack-liked-signup-flow

simple slack-liked-signup-flow app
Ruby
3
star
56

gollum-rails3

JavaScript
3
star
57

gitdown

Gollum & Showdown
JavaScript
3
star
58

bootstrap-helper3

Ruby
3
star
59

tx_ocr

Ruby
3
star
60

gitbook_template

Makefile
3
star
61

html5-practices

JavaScript
3
star
62

feedback4us

Ruby
3
star
63

srt-downloader

Ruby
3
star
64

my_bookstore

Ruby
3
star
65

my-blog

JavaScript
3
star
66

heroku-static-demo

heroku static demo
Ruby
2
star
67

job-level-up

2
star
68

twitio.us

JavaScript
2
star
69

tips-wiki

tips-wiki
Ruby
2
star
70

bootstrap_helper

this repo moves to http://github.com/xdite/bootstrap-helper
2
star
71

foam-research

SCSS
2
star
72

gitbook_gen

Ruby
2
star
73

pay2go

Ruby
2
star
74

twitter-message-wall-gae

twitter-message-wall Google Appengine version
Ruby
2
star
75

restful-crud-blog

CRUD-RESTFUL
2
star
76

redmine4ruby-lang

A little fork of redMine the issue tracking system, for hosting ruby-lang.org projects.
Ruby
2
star
77

merb-blog-crud

Ruby
2
star
78

d-veryxd

Ruby
2
star
79

try_git

1
star
80

homework_form

homework_form
Ruby
1
star
81

wechat-topic

1
star
82

AIEconomy

ๅˆฉ็”จ AI ๅ†™็ปๆตŽๆๆ€–ๅฐ่ฏดๅฎž้ชŒใ€‚
1
star
83

disaster-tw-2009

Ruby
1
star
84

golloum-pow

Golloum on Pow template
Ruby
1
star
85

bootstrap-demo

Ruby
1
star
86

backup-blog

HTML
1
star
87

railstank

Ruby
1
star
88

risk-control

1
star
89

roso

1
star
90

blog

Ruby
1
star
91

old-blog

JavaScript
1
star
92

backup-erp

JavaScript
1
star
93

til

1
star
94

omniauth-douban

omniauth for douban.com (working!)
Ruby
1
star
95

oprogram

simle yahoo oauth program
Ruby
1
star
96

railsxd.github.com

1
star
97

asset-pipeline-practices

JavaScript
1
star
98

bookreader

Ruby
1
star
99

ruby-taiwan-wiki

1
star
100

redmine_irccat_notifications

Ruby
1
star