Permalink
Browse files

Added docs for the updated to the menu system

  • Loading branch information...
1 parent 6c70cc8 commit 26def0e3791ffa4f88aa21b79f0a3834ccd0fd7d @gregbell gregbell committed Feb 25, 2012
Showing with 27 additions and 2 deletions.
  1. +6 −1 CHANGELOG.md
  2. +9 −1 docs/2-resource-customization.md
  3. +12 −0 lib/active_admin/menu.rb
View
@@ -8,7 +8,12 @@
### Deprecations
* Removed all references to ActiveAdmin::Renderer. If you were using these
- please update code to use an Arbre component
+ please update code to use an Arbre component. Removed
+ `ActiveAdmin:Views::HeaderRender` and replaced with
+ `ActiveAdmin::Views::Header` component.
+* ActiveAdmin::Menu and ActiveAdmin::MenuItem API has changed. If you were
+ creating custom menu items, the builder syntax has changed to. Menu#add now
+ accepts a MenuItem, instead of building the menu item for you.
## 0.4.2
@@ -35,7 +35,8 @@ the resource from being displayed in the global navigation, pass `false` to the
The menu method accepts a hash with the following options:
-* `:label` - The string label to display in the menu
+* `:label` - The string or proc label to display in the menu. If it's a proc, it
+ will be called each time the menu is rendered.
* `:parent` - The string label of the parent to set for this menu
* `:if` - A block or a symbol of a method to call to decide if the menu item
should be displayed
@@ -51,6 +52,13 @@ To change the name of the label in the menu:
By default the menu uses a pluralized version of your resource name.
+If you wish to translate your label at runtime, store the label as a proc
+instead of a string. The proc will be called each time the menu is rendered.
+
+ ActiveAdmin.register Post do
+ menu :label => proc{ I18n.t("mypost") }
+ end
+
### Drop Down Menus
In many cases, a single level navigation will not be enough for the
@@ -1,5 +1,17 @@
module ActiveAdmin
+ # Each Namespace builds up it's own menu as the global navigation
+ #
+ # To build a new menu:
+ #
+ # menu = Menu.new do |m|
+ # m.add MenuItem.new(:label => "Dashboard", :url => "/")
+ # m.add MenuItem.new(:label => "Admin", :url => "/admin")
+ # end
+ #
+ # If you're interested in configuring a menu item, take a look at the
+ # options available in `ActiveAdmin::MenuItem`
+ #
class Menu
attr_accessor :children

0 comments on commit 26def0e

Please sign in to comment.