Project

trap

0.0
Low commit activity in last 3 years
No release in over a year
Bootstrap helpers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 10.0
~> 3.0
 Project Readme

Trap Build Status

Bootstrap helpers. Bootstrap 4.x compatible.

Use trap 1.x for Bootstrap 3.x compatible.

Installation

Add this line to your application's Gemfile:

gem 'trap'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trap

Usage

After installing you should add line to application_helper.rb

module ApplicationHelper
  include Trap
end

List of methods you can use with Trap

Menu items

  • menu_item Bootstrap navbar item
<%= menu_item 'ButtonText', 'ButtonLink', class: 'some-classes', another_option: :value %>

Using menu_item instead of

<li>
  <a href="ButtonLink">
    ButtonText
  </a>
</li>
  • model_menu_item Bootstrap navbar item based on ActiveRecord
<%= model_menu_item model:, route:, icon:, number:, pluralize: %>

Dropdown

You can create dropdowns with something like this:

= dropdown t("admin.navbar.links.#{item.keys.first}") do
  = dropdown_item text, link
  = dropdown_divider
  = dropdown_model_item model: model, route: ::Tramway::Admin::Engine.routes.url_helpers.singleton_path(model: model)

For Bootstrap 3

You should use trap-1.x versions to include Bootstrap 3. Contributing to bootstrap-3 branch.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/trap/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request