No commit activity in last 3 years
No release in over 3 years
Tony Jian's Bootstrap helpers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

TJBootstrapHelper¶ ↑

This is Tony Jian’s Bootstrap helper gem.

Install¶ ↑

gme 'tj_bootstrap_helper'

or

gem 'tj_bootstrap_helper', :git => "git://github.com/tonytonyjan/tj-bootstrap-helper.git"

Helpers Usage¶ ↑

page_header¶ ↑

<%= page_header @post.title %>
# => <div class="page-header"><h1><%= @post.content %></h1></div>

<%= page_header @post.title, 2 %>
# => <div class="page-header"><h2><%= @post.content %></h2></div>

spans¶ ↑

Render Array¶ ↑

<%= spans %w(asfd qwer zxcv), fluid: true do |word| %>
  <h2><%= word %></h2>
  <p>content</p>
<% end %>

# =>

<div class="row-fluid">
  <div class="span4"><h2>asfd</h2><p>content</p></div>
  <div class="span4"><h2>qwer</h2><p>content</p></div>
  <div class="span4"><h2>zxcv</h2><p>content</p></div>
</div>

Render Resources¶ ↑

<%= spans @posts, :span => 3, :slice => 2 do |post| %>
  <h2><%= post.title %></h2>
  <p><%= post.content %></p>
<% end %>

# =>

<div class="row">
  <div class="span3"><h2><%= post.title %></h2><p><%= post.content %></p></div>
  <div class="span3"><h2><%= post.title %></h2><p><%= post.content %></p></div>
</div>

...

<div class="row">
  <div class="span3"><h2><%= post.title %></h2><p><%= post.content %></p></div>
  <div class="span3"><h2><%= post.title %></h2><p><%= post.content %></p></div>
</div>

thumbs¶ ↑

The usage of thumbs is nothing more than spans, but it requires a parameter of image method name correspondding to each resource.

Thumbnails Only¶ ↑

<%= thumbs @posts, "image_url", :span => 2, :slice => 2 %>

# =>

<ul class="thumbnails">
  <li class="post span2" id="post_1"><a href="/posts/1" class="thumbnail"><%= image_tag post.image_url %></a></li>
  <li class="post span2" id="post_2"><a href="/posts/2" class="thumbnail"><%= image_tag post.image_url %></a></li>
</ul>

...

<ul class="thumbnails">
  <li class="post span2" id="post_3"><a href="/posts/3" class="thumbnail"><%= image_tag post.image_url %></a></li>
  <li class="post span2" id="post_4"><a href="/posts/4" class="thumbnail"><%= image_tag post.image_url %></a></li>
</ul>

With Caption¶ ↑

<%= thumbs @posts, "image_url" do |post| %>
  <h2><%= post.title %></h2>
  <p><%= post.content %></p>
<% end %>

# =>

<ul class="thumbnails">
  <li class="post span4" id="post_1">
    <div class="thumbnail">
      <%= image_tag post.image_url %>      
      <h2><%= post.title %></h2>
      <p><%= post.content %></p>
    </div>
  </li>

  ...

</ul>