BootstrapBuilders

Install

Add to your Gemfile and bundle:

gem "bootstrap_builders"

Then add to your ApplicationHelper module:

module ApplicationHelper
  include BootstrapBuilders::ApplicationHelper
end

Usage

Panel

  1. Panel in all its glory with elements and classes
  2. Controls if :right argument is given
  3. Table if :table argument is given
= bb_panel "Title of panel", right: button_content do
  Content of panel

Panel with a table

= bb_panel "Title of panel", table: true do
  %tbody
    %tr
      %td= "Test"

You can add custom classes like this:

= bb_panel "Title of panel", table: {bs_classes: [:striped]} do
  %tbody
    %tr
      %td Test

Table

  1. Adds Bootstrap classes: "table", "table-hover", "table-striped"
= bb_table do
  %tbody
    %tr
      %td= "Test"

You can change the default classes like this:

BootstrapBuilders.configuration.default_table_classes = [:striped, :hover]

The classes "bb-table" and "table" are always added.

Buttons

  1. Adds icons automatically
  2. Adds labels automatically
  3. Doesn't show button if CanCan doesn't allow it
= bb_new_btn url: [:admin, User]
= bb_edit_btn url: [:admin, user], mini: true
= bb_destroy_btn url: [:admin, user], label: false
= bb_btn "/url", "My label", :block, :lg, confirm: true

Contributing to bootstrap_builders

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright (c) 2016 kaspernj. See LICENSE.txt for further details.