A collection of Rails helpers to output formatting for Twitter Bootstrap.
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
MIT-LICENSE
README.rdoc
Rakefile
twitter_bootstrap_helper.gemspec

README.rdoc

TwitterBootstrapHelper

Refer to the rdoc documentation for this helper. I'm working on more examples.

This project rocks and uses MIT-LICENSE.

Navs

Navs require a bit of HTML to create. These helpers make it a little easier.

<%= tb_nav do %>
    <%= tb_nav_item(:dropdown => "Options", :html => {:id => "options-dropdown-button"}) do %>
        <%= tb_nav(:dropdown_menu, :html => {:id => "options-dropdown"}) do %>
            <%= tb_nav_item tb_link("Option 1", "#")) %>
            <%= tb_nav_item tb_link("Option 2", "#")) %>
            <%= tb_nav_item :divider %>
            <%= tb_nav_item tb_link(" Option 3", "#", :icon => "icon-ok")) %>
        <% end %>
    <% end %>
    <span class="btn-group pull-left">
      <%= tb_link("", "#", :icon => "icon-minus", :class => "btn", :id => "zoom-out-button") %>
      <%= tb_link("", "#", :icon => "icon-plus", :class => "btn", :id => "zoom-in-button") %>
    </span>
<% end %>

Modals

There are a couple of helpers to assist with creating and activating modals. One to create a button to activate a modal, and one to create the modal and the content itself.

The tb_modal_button helper takes the same options as tb_link

<%= tb_modal_button " Edit", "editModal", :class => "btn btn-success", :icon => "icon-edit" %>

For the actual modal, use tb_modal

<%= tb_modal "editModal", "Content of the modal", title: "Edit", ok_id: "submit-button", ok_label: "Save", ok_link: edit_object_path(@object), ok_class: "btn btn-success" %>

You can also use it as a block:

<%= tb_modal "editModal", title: "Edit", ok_id: "submit-button", ok_label: "Save", ok_link: edit_object_path(@object), ok_class: "btn btn-success" do %>
    Modal Content
<% end %>