bootstrap-helper

by xdite

Twitter Bootstrap Helper for Rails, support will_paginate & simple_form template

199 Stars 61 Forks Last release: Not found 56 Commits 19 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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

renderpagetitle

SETUP

edit your

config/application.rb
SITE_NAME = "YOUR SITE NAME"

in

application.html.erb
, replace
 with 
 

define page title in your action

def index
  @page_title = "Posts Index"
end

will render

Posts Index | YOUR SITE NAME

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"

 "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 %>

renderbodytag

in

application.html.erb
, replace
 with 
 

renderbodytag auto inserts "controller name" & "action name" in to body class, and generates IE conditional comment.



breadcrumb

in

application.html.erb
, place this helper

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

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

    {:class => "xxlarge"} , :hint => "this is post title" %>

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.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.