ActiveAdmin 中的默认显示页面是一个表,每行一个属性。对于我的后端,这很好,除了我想隐藏 id、created_at、updated_at 等字段。
是否有可能以类似于索引页面的方式做到这一点,即通过明确列出所需的属性,同时让 AtiveAdmin 处理布局?
文档中显示的唯一示例表明,要自定义显示页面,您必须完全接管并编写部分或 arbre 构造。
谢谢!
ActiveAdmin 中的默认显示页面是一个表,每行一个属性。对于我的后端,这很好,除了我想隐藏 id、created_at、updated_at 等字段。
是否有可能以类似于索引页面的方式做到这一点,即通过明确列出所需的属性,同时让 AtiveAdmin 处理布局?
文档中显示的唯一示例表明,要自定义显示页面,您必须完全接管并编写部分或 arbre 构造。
谢谢!
I think you're looking for attributes_table:
show do
attributes_table :name, :content
end
See https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/show.rb if you're curious.
(I completely removed my prior answer because it was basically useless!)
show do
attributes_table do
row :profilepic do
image_tag admin_user.profilepic.url, class: 'my_image_size'
end
row :name
row :email
row :adrs
row :phone
row :role
row :salary
row :parent_id
row :joindate
end
结尾