Skip to content
Bootstrap sass gem wrapper, specially created for Ruby on Rails apps
CSS Ruby HTML Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Update select2-rails.coffee Jul 25, 2019
lib Bump Jul 25, 2019
test Add initial support for Bootstrap 4.0.0.alpha Aug 25, 2015
vendor/assets/javascripts Update tether patch Sep 1, 2016
.gitignore .gitignore update Apr 28, 2017
Gemfile rename to binco Apr 24, 2015
Gemfile.lock
MIT-LICENSE
README.md update readme to reflect removal of will paginate dependency Jul 23, 2019
Rakefile add breadcrumb helper, rename namespace to binco Apr 24, 2015
binco.gemspec Remove will_paginate from gem dependencies Jul 23, 2019

README.md

Binco

This is a wrapper for adding bootstrap to a project. By includinig this gem you'll add:

Installation

To install simply include into Gemfile:

gem 'binco'

and run:

bundle install

Automatic

Run rails g binco:install

This creates the application.scss with binco (and bootstrap) included, your _bootstrap-overrides.scss file and insert assets into javascript manifest.

Manual Installation

In your application.scss add:

@include "binco"

In your application.js add:

//= require binco

Optional

For customization of datepicker make sure to include your locale js and send it as data attribute when creating a datepicker.

# app/assets/javascripts/application.js

//= require bootstrap-datepicker/locales/bootstrap-datepicker.es.js
//= require select2_locale_es

$.fn.datepicker.defaults.language = 'es'

Usage

<%= bootstrap_form_for(@object) do |f| %>
  <%= f.form_group do %>
    <%= f.label :product_id %>
    <%= f.collection_select :product_id, @products, :id, :name, class: 'special-select-class-if-needed' %>
  <% end %>

  <%= f.form_group do %>
    <%= f.label :name %>
    <%= f.number_field :name %>
  <% end %>

  <!-- select2 support -->
  <%= f.form_group do %>
    <%= f.label :product %>
    <%= f.collection_select2 :product_id, @products, :name, :id %>
  <% end %>

  <!-- select2 support for checkboxes -->
  <%= f.form_group do %>
    <%= f.label :products %>
    <%= f.collection_check_boxes2 :product_id, @products, :name, :id %>
  <% end %>

  <%= f.submit 'Great!' %>
<% end %>

Modals

<%= modal 'filter-modal' do %>
  <%= modal_header 'One fine title'%>
  <%= modal_body do %>
    One fine body
  <% end %>
  <%= modal_footer do %>
    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
    <button type="button" class="btn btn-primary" data-dismiss="modal">Submit</button>
  <% end %> <!--  end modal_footer -->
<% end %> <!-- end modal -->

Breadcrumbs

In your layout render the partial wherever your like

<%= render 'binco/breadcrumb' %>

In your views, add an element to breadcrumb with:

<% breadcrumb_add(title: 'new', url: pages_new_path) %>

Notice that first in first out. So be careful with the order.

Your can configure your placeholder and default url for the breadcrumb in an initializer:

Binco.configure do |binco|
  binco.breadcrumb_before = { title: 'You are here' }
  binco.breadcrumb_default = [
    { title: 'Index', url: '/' }
  ]
end

Pagination

Will Paginate

Add Will Paginate to your Gemfile

gem "will_paginate", '~> 3.0'
# controller
@posts = Post.all.page(params[:page])
<!-- View -->
<%= render 'binco/pagination', collection: @posts %>

This project rocks and uses MIT-LICENSE.

You can’t perform that action at this time.