Reputation: 15262
I have too many models in my rails app. And they don't fit in the top menu bar in active admin.
I would like to know how to display the top menu tabs, in a vertical menu via the dashboard?
Thanks in advance.
Eg:
Dashboard.rb
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
div :class => "blank_slate_container", :id => "dashboard_default_message" do
span :class => "blank_slate" do
span I18n.t("active_admin.dashboard_welcome.welcome")
small I18n.t("active_admin.dashboard_welcome.call_to_action")
end
end
# Here is an example of a simple dashboard with columns and panels.
#
# columns do
# column do
# panel "Recent Posts" do
# ul do
# Post.recent(5).map do |post|
# li link_to(post.title, admin_post_path(post))
# end
# end
# end
# end
# column do
# panel "Info" do
# para "Welcome to ActiveAdmin."
# end
# end
# end
end # content
end
Upvotes: 1
Views: 3685
Reputation: 6818
You can use the :parent
option to the menu
method to assign each model into a menu drop down in each model's admin file.
So:
ActiveAdmin.register User do
menu :parent => "User Data"
end
If you want to create a list of links on the dashboard page, your code would look something like this:
content :title => proc{ I18n.t("active_admin.dashboard") } do
columns do
column do
panel "Models" do
ul do
li link_to("Users", admin_users_path)
li link_to("Admin Users", admin_admin_users_path)
end
end
end
end
Upvotes: 4