2013-06-03 13 views

Odpowiedz

15

Konsolidacja odpowiedzi i dodanie nieco:

Większość z nich znajduje się na this page on the wiki (lub wkrótce ją tu umieszczę).

W pliku, który zarejestruje swój model activeadmin (np app/admin/user.rb), można mieć

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

Zgodnie this post, można użyć wiersza jak następuje w działaniu wyboru:

@page_title="My Custom Title" 

Na przykład, aby wdrożyć to w uprzednio istniejących akcji jak „nowy”, by coś zrobić tak:

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

Po wyszukaniu got it,

można dodać: atrybut title do bloków aktywnego administratora.

np

1) Ustawienie tytuł strony indeksu

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

2) Aby określić tytuł wykazują stronie

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

więcej szczegółów kasie: https://github.com/gregbell/active_admin/wiki/Set-page-title – bunty

0

Wystarczy zrobić

index title: "Me new title" 
Powiązane problemy