Browse files

Added docs for :if options on sidebar and action items

  • Loading branch information...
1 parent 06eec3d commit 813c86b000d937e67ff4cc61fa3322c1a60edfbf @gregbell gregbell committed Feb 3, 2012
Showing with 13 additions and 0 deletions.
  1. +7 −0 docs/7-sidebars.md
  2. +6 −0 docs/8-custom-actions.md
View
7 docs/7-sidebars.md
@@ -25,6 +25,13 @@ options.
"Need help? Email us at help@example.com"
end
+If you want to conditionally display a sidebar section, use the :if option and
+pass it a proc which will be rendered within the context of the view.
+
+ sidebar :help, :if => proc{ current_admin_user.super_admin? }
+ "Only for super admins!"
+ end
+
If you only pass a symbol, Active Admin will attempt to locate a partial to render.
# Will render app/views/admin/posts/_help_sidebar.html.erb
View
6 docs/8-custom-actions.md
@@ -92,6 +92,12 @@ post:
link_to('View on site', post_path(post)) if post.published?
end
+Actions items also accept the :if option to conditionally display them:
+
+ action_item :only => :show, :if => proc{ current_admin_user.super_admin? } do
+ "Only display this to super admins on the show screen"
+ end
+
### Page Titles
The page title for the custom action will be the internationalized version of

0 comments on commit 813c86b

Please sign in to comment.