roidrage / crumble Goto Github PK
View Code? Open in Web Editor NEWHow did these breadcrumbs in your Rails application? Oh right, with this plugin!
Home Page: http://github.com/mattmatt/crumble
How did these breadcrumbs in your Rails application? Oh right, with this plugin!
Home Page: http://github.com/mattmatt/crumble
Hi there, tried this plugin for my breadcrumbs but ended up abandoning it in favour of a solution inspired by yours. A helper coupled with lots of url helpers for each of my modules which each generate a particular crumb. One weakness I found in yours is that it didn't seem to support polymorphic url's, only named routes. Just a thought for future development :)
Brendon
Thanks for this plugin, it just works!
Is it possible to wrap each crumb in a specific HTML element, such as
Hi,
I followed the Readme on Github to install Crumble via gem, added configuration, initializers - but the script/server failed to load the gem. I also confirmed this via script/console. I even tried the script/plugin install method.
I can confirm that the gem was installed in /usr/lib/ruby/gems/1.8/gems/crumble-0.1.2.
I'm running
Gem - 1.3.7
Rails - 2.3.5
OS - Ubuntu
Thanks for such an awesome gem :)
Maku
Maybe I'm missing something, but I'm having this strange behavior:
The breadcumbs are only printed on the first time the helper 'crumbs' is executed.
Any posterior calls returns "". Posterior calls to Breadcrumb.instance.trails returns nil.
Any thoughts?
Some routes are causing problems for me, specifically these:
http://localhost:3000/projects/2/releases/1/sprints/new
http://localhost:3000/projects/2/releases/1/teams/new
The error I get says:
project_url failed to generate from {:action=>"show", :controller=>"projects"} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: ["projects", :id] - are they all satisfied?
Here's my breadcrumbs.rb configuration file:
Breadcrumb.configure do
# Specify name, link title and the URL to link to
crumb :root, "Dashboard", :root_url
crumb :project, "Project", :project_url
crumb :story, "Story", :project_story_url
crumb :task, "Task", :project_task_url
crumb :release, "Release", :project_release_url
crumb :sprint, "Sprint", :project_release_sprint_url
crumb :team, "Team", :project_release_team_url
# Specify controller, action, and an array of the crumbs you specified above
trail :projects, :dashboard, [:root]
trail :projects, [:show, :new, :edit], [:root, :project]
trail :stories, [:new, :show, :edit], [:root, :project, :story]
trail :tasks, [:new, :show, :edit], [:root, :project, :task]
trail :releases, [:new, :show, :edit], [:root, :project, :release]
trail :sprints, [:new, :show, :edit], [:root, :project, :release, :sprint]
trail :teams, [:new, :show, :edit], [:root, :project, :release, :team]
# Specify the delimiter for the crumbs
delimit_with " / "
dont_link_last_crumb
end
Here's my routes.rb file:
ActionController::Routing::Routes.draw do |map|
map.root :controller => 'projects', :action => 'index'
map.dashboard "dashboard", :controller => 'projects', :action => 'dashboard'
map.project_settings "projects/:id/settings", :action => 'settings', :controller => 'projects'
map.project_unassigned_stories "projects/:project_id/stories/unassigned", :action => 'unassigned', :controller => 'stories'
map.resources :projects do |projects|
projects.resources :stories do |stories|
stories.resources :comments
stories.resources :watches
stories.resources :votes
stories.resources :tags
stories.resources :tasks
stories.resources :defects
stories.resources :attachments
stories.resources :timers, :collection => { :stop => :post, :elapsed => :get }
end
projects.resources :releases do |releases|
releases.resources :teams
releases.resources :sprints
end
projects.resources :pages
end
map.connect ':controller/:id/:action'
map.connect ':controller/:id/:action.:format'
end
When I use crumbs
helper in partials it returns nothing. It would be great to allow use crumbs
in partials, cause I want to wrap bread crumbs in an html element without duplications of code.
Thanks.
I wanted to generate breadcrumb with extra params for edit controller. for eg:
/company/1/edit?section=extra
I tested as:
crumb :crumb_with_param, "Params BreadCrumb", :edit_company_url, :company, :params => :section
But I couldn't get desired output. How can we write crumb for that one?
Hi there,
I have a need to configure breadcrumbs in multiple places dynamically. for example, i have the intended config/initializers/breadcrumbs.rb, which have the Breadcrumb.configure in it. But i also have a need to define breadcrumbs dynamically elsewhere based on some logic. So i call Breadcrumb.configure again and every crumbs defined anywhere else (like the one in config) gets cleared.
I notice that this is due to lines 34 and 35 in crumble/lib/breadcrumb.rb. is there a reason why this needs to be cleared out? i'd like to be able to add more crumbs and use already defined ones dynamically.
Thank you!
Hi Matt,
Great work. Functions perfectly.
How do I make the last crumb in the breadcrumbs trails -- the crumb that represents the current page -- not be a link?
Followed your instructions to a T, but I'm getting a "uninitialized constant Breadcrumb" error. I'm running Rails 3.0.0.beta3. I installed crumble as a gem, and it shows up with "gem list" as installed.
Any thoughts what I should check?
I've found a way to do reloading of breadcrumbs in development mode. You should place Breadcrumb.configure do ... end
in config/breadcrumbs.rb, and use this as initializer:
reloader = ActiveSupport::FileUpdateChecker.new(%w{config/breadcrumbs.rb}) do
load 'config/breadcrumbs.rb'
end
ActionDispatch::Callbacks.to_prepare do
reloader.execute_if_updated
end
As I've never developed Rails plugins, I do not know how to hook it up, but that shouldn't be too hard.
Hi, I need to truncate the crumb strings generated to some letters, I am using truncate method, but it does'nt seem to be working properly for me if I put anywhere in breadcrumbs_helper, where we are returning the crumbs. I am using it something like this truncate(name, :length=>10, :ommission=>'...'). Can you please provide me any solution.
For Ex: home // Search me - abcd...
So if the dynamic string generated is "abcdefg", then I want to display "abcd...", So to display this we need to have truncate method on the dynamic value.
I was getting a "no method error" when I tried to use the crumbs
method in my views. When I manually copied the BreadcrumbsHelper and put it in my Rails app, it worked. It seems like the helper isn't getting included successfully.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.