Skip to content

Commit

Permalink
Add application config option to remove breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
quainjn committed Jan 23, 2014
1 parent d0eb6d9 commit 4bc0eea
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions features/breadcrumb.feature
Expand Up @@ -25,3 +25,14 @@ Feature: Breadcrumb
"""
When I am on the new post page
Then I should see a link to "test" in the breadcrumb

Scenario: No Breadcrumbs configuration
Given a configuration of:
"""
ActiveAdmin.application.breadcrumb = false
ActiveAdmin.register Post do
end
"""
When I am on the new post page
Then I should see "Post"
And I should not see the element ".breadcrumb"
3 changes: 3 additions & 0 deletions lib/active_admin/application.rb
Expand Up @@ -67,6 +67,9 @@ def initialize
# The namespace root.
inheritable_setting :root_to, 'dashboard#index'

# Display breadcrumbs
inheritable_setting :breadcrumb, true

# Default CSV options
inheritable_setting :csv_options, {:col_sep => ','}

Expand Down
2 changes: 2 additions & 0 deletions lib/active_admin/views/title_bar.rb
Expand Up @@ -26,6 +26,8 @@ def build_titlebar_right
end

def build_breadcrumb(separator = "/")
return unless active_admin_namespace.breadcrumb

links = if active_admin_config && active_admin_config.breadcrumb.present?
instance_exec(controller, &active_admin_config.breadcrumb)
else
Expand Down
Expand Up @@ -147,6 +147,14 @@ ActiveAdmin.setup do |config|
# config.favicon = '/assets/favicon.ico'


# == Removing Breadcrumbs
#
# Breadcrumbs are enabled by default. You can customize them for individual
# resources or you can disable them globally from here.
#
# config.breadcrumb = false


# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
Expand Down

0 comments on commit 4bc0eea

Please sign in to comment.