Skip to content

Instantly share code, notes, and snippets.

@pashagray
Last active June 3, 2018 04:15
Show Gist options
  • Save pashagray/2174317bbde5a79fb831da1b9252d78f to your computer and use it in GitHub Desktop.
Save pashagray/2174317bbde5a79fb831da1b9252d78f to your computer and use it in GitHub Desktop.
Example crumbs DSL
# lib/breadcrumbs/admin_breadcrumbs.rb
AdminBreadcrumbs = Crumbs.build do
framework :rails
namespace :admin
crumb 'welcome#index' do
link 'Дашборд'
end
crumb 'users#index' do
link 'Сотрудники'
parent 'welcome#index'
end
crumb 'users#show' do |user|
link user.title
parent 'users#index'
end
crumb 'users#edit' do |user|
link 'Редактировать'
parent 'users#show', user
end
end
# some layout
AdminBreadcrumbs.draw(params)
# admin/users/index.slim
AdminBreadcrumbs.expose
# admin/users/show.slim
AdminBreadcrumbs.expose(@user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment