File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ options.
2525 "Need help? Email us at [email protected] " 2626 end
2727
28+ If you want to conditionally display a sidebar section, use the : if option and
29+ pass it a proc which will be rendered within the context of the view.
30+
31+ sidebar :help, :if => proc{ current_admin_user.super_admin? }
32+ "Only for super admins!"
33+ end
34+
2835If you only pass a symbol, Active Admin will attempt to locate a partial to render.
2936
3037 # Will render app/views/admin/posts/_help_sidebar.html.erb
Original file line number Diff line number Diff line change 9292 link_to('View on site', post_path(post)) if post.published?
9393 end
9494
95+ Actions items also accept the : if option to conditionally display them:
96+
97+ action_item :only => :show, :if => proc{ current_admin_user.super_admin? } do
98+ "Only display this to super admins on the show screen"
99+ end
100+
95101### Page Titles
96102
97103The page title for the custom action will be the internationalized version of
You can’t perform that action at this time.
0 commit comments