At minimal I want to achieve some indentation in index table. Like this:
+Parent
+--Child
+--Child of Child
+--Child
So I create the following:
ActiveAdmin.register Section do
config.filters = false
index do
column :name do |s|
" #{ "――" * s.depth } #{s.name}"
end
default_actions
end
controller do
def collection
Section.some_method_to_get_things_in_right_order
end
end
end
It's need to some_method return active record relation, but I haven't succeed. And ended up with this hacky way.
The sortable_tree activeadmin plugin works for me well with closure tree.
https://github.com/zorab47/active_admin-sortable_tree
It creates a simple hierarchical and sortable view.
Just put the following in your tree model resource (app/admin/TreeModel): (assuming Rails >4, replace <..> with your values)