Skip to content

Tasty breadcrumbs! Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.

License

Notifications You must be signed in to change notification settings

zachinglis/crummy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crummy

Introduction

Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.

Install

To install, type script/plugin install git://github.com/zachinglis/crummy.git

Example

In your controllers you may add_crumb either like a before_filter or within a method (It is also available to views).

  
    class ApplicationController
      add_crumb "Home", '/'
    end
    
    class BusinessController < ApplicationController
      add_crumb("Businesses") { |instance| instance.send :businesses_path }
      add_crumb("Comments") { |instance| instance.send :businesses_path }, :only => "comments"
  
      def show
        add_crumb @business.display_name, @business
      end
    end
  

Then in your view:

  
    <%= render_crumbs %>
  

You can specify an argument for a separator, but it defaults to " &raquo; ". A crumb with a nil link will just output plain text.

Notes

The variable set is set to @_crumbs not to conflict with your code.

Todo

  • Port over rspecs from project to plugin (Fully tested in a project)
  • Accept instances of models as a single argument
  • Allow for variables in names. (The workaround is to do your own before_filter for that currently)

Credits

Copyright © 2008 Zach Inglis, released under the MIT license

About

Tasty breadcrumbs! Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published