Skip to content

Commit

Permalink
Merge pull request activeadmin#1264 from kamarcum/resource_show_displ…
Browse files Browse the repository at this point in the history
…ay_name

Use display_name to generate the default title on resource show
  • Loading branch information
pcreux committed May 3, 2012
2 parents c1fe2f7 + ebbd37d commit 6cbe3a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion features/i18n.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Internationalization
Then I should see "Hello words"
When I follow "View"
Then I should see "Bookstore Details"
And I should see "Bookstore #"
And I should see "Bookstore: Hello words"
And I should see a link to "Delete Bookstore"
When I follow "Edit Bookstore"
Then I should see "Edit Bookstore"
Expand Down
8 changes: 8 additions & 0 deletions features/show/page_title.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ Feature: Show - Page Title
end
"""
Then I should see the page title "Title: Hello World"

Scenario: No configuration
Given a show configuration of:
"""
ActiveAdmin.register Post do
end
"""
Then I should see the page title "Post: Hello World"
2 changes: 1 addition & 1 deletion lib/active_admin/views/pages/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def attributes_table(*args, &block)
protected

def default_title
"#{active_admin_config.resource_label} ##{resource.id}"
"#{active_admin_config.resource_label}: #{display_name(resource)}"
end

module DefaultMainContent
Expand Down

0 comments on commit 6cbe3a1

Please sign in to comment.