0.01
No commit activity in last 3 years
No release in over 3 years
Automatically add breadcrumbs to each page by using locales
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Auto Breadcrumbs Build Status

Automatically add breadcrumbs to each page by using locales and gem breadcrumbs_on_rails.

Installation

Add this line to your application's Gemfile:

gem 'auto_breadcrumbs'

And then execute:

$ bundle

To generate locale file run:

$ rails g auto_breadcrumbs:install

Usage

  1. Include auto_breadcrumbs in your controller:
class ApplicationController < ActionController::Base
  include AutoBreadcrumbs
  ...
end
  1. Fill your locale file:
en:
  auto_breadcrumbs:
    root: 'Home'
    actions:
      new: 'New'
      show: 'Show'
      edit: 'Edit'
    controllers:
      users:
        index: 'Users'
        edit: 'Settings'
        sync: 'Synchronization'
      ...
  1. Use helper method to show breadcrumbs in your view file:
<body>
  <%= render_breadcrumbs %>
</body>

For example, if you go to /users/1/edit it will show breadcrums like Home / Users / Settings.

In case when translations are absent it will try to build breadcrumbs automatically depending on resource and action names. For example, if you visit /countries/new it will show breadcrums Home / Countries / New.

You can also use helper methods resource_translation and action_translation like this:

<!DOCTYPE html>
<html>
  <head>
    <title><%= [resource_translation, action_translation].compact.join(' | ') %></title>
  </head>
</html>

Customization

For more information about customization of breadcrumbs visit breadcrumbs_on_rails.

Contributing

  1. Fork it
  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 new Pull Request