Project

bready

0.0
No commit activity in last 3 years
No release in over 3 years
Bready is a tool for building breadcrumbs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 2.11.3
= 2.4.3
 Project Readme

Bready is a tool for building breadcrumbs

Install

In console:

gem install bready

or in your Gemfile:

gem 'bready'

Configure

It can work with or without Rails. Here is an example of usage when you want to use it with the Ruby on Rails framework. First you need to create a configuration file config/initializers/bready.rb

Bready::Breadcrumbs.setup do |config|
  # delimiter between parts of breadcrumbs
  config.delimiter = ' | '
  
  # Root chunk that will be used as a first chunk always
  config.root_chunk = ['Home', '/']
  
  # the name of the tag that wraps breadcrumbs
  config.block_tag = 'div'

  # set the class for tag that was described above
  config.block_class = 'breadcrumbs'
end

Usage

You can pass an array of breadcrumb chunks into initializer method like this:

bready = Bready::Breadcrumbs.new([
  ['Categories', '/Categories/'],
  ['Products', '/Products/'],
])

You can add more chunks later on. Here are examples of how to do it:

bready.add_chunk(['Products', '/Products/'])

To add more than one chunk:

bready.add_chunks([['Products', '/Products/'], ['Products2', '/Products2/']])

In the view you can render breadcrumbs by simply calling render method of an instance:

bready.render