2013-06-03 114 views

回答

15

合併的答案,加入少許:

大部分這是在this page on the wiki(或者我會盡快放在那裏)。

在其登記您的activeadmin(如應用程序/管理/ user.rb)模型的文件,你可以有

ActiveAdmin.register User do 
    # a simple string 
    index :title => "Here's a list of users" do 
    ... 
    end 

    # using a method called on the instance of the model 
    show :title => :name do 
    ... 
    end 

    # more flexibly using information from the model instance 
    show :title => proc {|user| "Details for "+user.name } do 
    ... 
    end 

    # for new, edit, and delete you have to do it differently 
    controller do 
    def edit 
     # use resource.some_method to access information about what you're editing 
     @page_title = "Hey, edit this user called "+resource.name 
    end 
    end 
end 
1

按照this post,你可以用一條線就像選擇的動作如下:

@page_title="My Custom Title" 

例如,爲了實現這個像「新」預先存在的動作,你會做什麼像這樣:

controller do 
    def new do 
    @page_title="My Custom Title" 
    new! do |format| 
     format.html{render "my_new"} 
    end 
    end 
end 
9

後搜索了它,

您可以添加:title屬性爲主動管理的塊。

1)要設置索引頁標題,

index :title => 'Your_page_name' do 
.... 
end 

2)要設置顯示頁面標題,

show :title => 'Your_page_name' do 
.... 
end 
+1

:HTTPS:/ /github.com/gregbell/active_admin/wiki/Set-page-title – bunty

0

只需瞭解更多詳情結帳做

index title: "Me new title"