Customizing the show page in ActiveAdmin

15,569

Solution 1

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!)

Solution 2

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

end

Share:
15,569
Giuseppe
Author by

Giuseppe

Updated on June 05, 2022

Comments

  • Giuseppe
    Giuseppe almost 2 years

    The default show page in ActiveAdmin is a table with one attribute per row. For my backend, this would be fine, except that I want to hide fields such as id, created_at, updated_at.

    Is is possible to do that in a way similar to the index page, i.e. by explicitly listing the desired attributes, while letting AtiveAdmin handle the layout?

    The only example shown in the docs suggests that to customize the show page you have to completely take over and write a partial or an arbre construct.

    Thanks!

  • Giuseppe
    Giuseppe over 12 years
    That is exactly what I needed. Thanks!
  • Salomanuel
    Salomanuel almost 6 years
    those links are not working anymore, does someone have alternative links?