forked from activeadmin/activeadmin
-
Notifications
You must be signed in to change notification settings - Fork 1
Set page title
Tiago Moraes edited this page Jan 25, 2014
·
8 revisions
If you'd like to override the page titles, follow this pattern (from #184)
ActiveAdmin.register Post do
# Custom string
index :title => 'Awesome Title' do
# ...
end
# Call a method
show :title => :my_title_method do
# ...
end
# execute some code
show :title => proc{ post.title } do
# ...
end
# Custom actions
collection_action :comments, :title => "My Awesome Comments" do
# do stuff
end
endHowever, this doesn't yet handle the edit page because the form method ignores the :title. For edit pages, do this instead:
ActiveAdmin.register Post do
controller do
def edit
@page_title = "Awesome Title"
end
end
endOr, for all pages at once do this (from #2891):
ActiveAdmin.register Post do
controller do
before_filter { @page_title = "#{current_user} Posts" }
end
end