Add to your Gemfile and bundle:
gem "bootstrap_builders"
Then add to your ApplicationHelper
module:
module ApplicationHelper
include BootstrapBuilders::ApplicationHelper
end
Then add to your application.js
:
//= require bootstrap_builders
Then add to your application.css
:
//= require bootstrap_builders
- Panel in all its glory with elements and classes
- Controls if
:right
argument is given - Table if
:table
argument is given
= bb_panel "Title of panel", controls: button_content do
Content of panel
= bb_panel "Title of panel", controls: button_content do |panel|
- panel.controls << bb_btn("#", "Another button", :mini)
Content of panel
= 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
- Adds Bootstrap classes: "table", "table-hover", "table-striped"
= bb_table do
%tbody
%tr
%td= "Test"
- A table showing a models attributes:
= bb_table do
%tbody
= bb_attribute_rows @model, [:id, :created_at, :updated_at]
You can change the default classes like this:
BootstrapBuilders.configuration.default_table_classes = [:striped, :hover]
The classes "bb-table" and "table" are always added.
- Adds icons automatically
- Adds labels automatically
- Doesn't show button if CanCan doesn't allow it
= bb_new_btn url: [:admin, User]
= bb_edit_btn url: [:admin, user], :mini
= bb_destroy_btn url: [:admin, user], label: false
= bb_btn "/url", "My label", :block, :lg, :confirm, :disabled
= bb_tabs do |tabs|
= tabs.tab "Title" do
Content of tab
= bb_tabs :pills, :stacked do |tabs|
= tabs.tab "Title", "id-of-content-container" do
Content of tab
= tabs.tab "Load on demand", ajax_url: some_path
Pre-select a tab by using the query parameter called "bb_selected_tab" like so: "?bb_selected_tab=id-of-content-container". This will also work with ajax tabs.
= bb_flash
- 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.