2013-06-03 15 views

Antwort

15

Antworten Konsolidieren und mit ein wenig gesetzt:

Das meiste davon ist auf this page on the wiki (oder ich werde es bald dort).

Innerhalb der Datei, die das Modell für activeadmin registriert (zB app/admin/user.rb), können Sie

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

Per this post Sie eine Zeile wie die folgende in der Wirkung der Wahl verwenden können:

@page_title="My Custom Title" 

Zum Beispiel diese in einem bereits bestehenden Aktion wie ‚neu‘ zu implementieren, würden Sie etwas tun dies wie:

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

Nachdem es kann

bekam suchen Sie hinzufügen: Titel Attribut Blöcke von aktiven Admin.

zB

1) Zur Titel für Indexseite,

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

2) So legen Titel für die Show Seite,

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

für mehr Kasse Details: https://github.com/gregbell/active_admin/wiki/Set-page-title – bunty

0

einfach tun haben

index title: "Me new title" 
Verwandte Themen