在 ActiveAdmin 中设置自定义页面的标题
Set the title of Custom Pages in ActiveAdmin
我一直在寻找有关如何 modify the title of an ActiveAdmin Custom page 的信息,但没有任何效果。我找到的解决方案仅适用于标准 ActiveAdmin 页面。
比如我的Report
页面
ActiveAdmin.register_page "report" do
controller do
before_action { @page_title = "Generación de reportes" }
end
menu label: 'Generación de reportes'
content do
render partial: 'report'
end
end
显示标准标题,与注册的字符串相同。
有什么方法可以自定义标题,比如我可以放 "Generación de reportes" 之类的东西吗?
在 your provided link 中,您可以通过以下选项修改页面标题:
content 'title': Proc.new {
@page_title = 'Your title'
} do
...
end
或其他选项,根据文档:
content title: "Your Title" do
...
end
根据文档,您必须在 same link 中看到“自定义页面 标题栏中的图像或 link”!
您在注册 controller
时使用 before_action
,但在提供的代码中,您注册的是 page
。
希望对您有所帮助!
我一直在寻找有关如何 modify the title of an ActiveAdmin Custom page 的信息,但没有任何效果。我找到的解决方案仅适用于标准 ActiveAdmin 页面。
比如我的Report
页面
ActiveAdmin.register_page "report" do
controller do
before_action { @page_title = "Generación de reportes" }
end
menu label: 'Generación de reportes'
content do
render partial: 'report'
end
end
显示标准标题,与注册的字符串相同。
有什么方法可以自定义标题,比如我可以放 "Generación de reportes" 之类的东西吗?
在 your provided link 中,您可以通过以下选项修改页面标题:
content 'title': Proc.new {
@page_title = 'Your title'
} do
...
end
或其他选项,根据文档:
content title: "Your Title" do
...
end
根据文档,您必须在 same link 中看到“自定义页面 标题栏中的图像或 link”!
您在注册 controller
时使用 before_action
,但在提供的代码中,您注册的是 page
。
希望对您有所帮助!