Skip to content

Commit

Permalink
Added docs for the updated to the menu system
Browse files Browse the repository at this point in the history
  • Loading branch information
gregbell committed Feb 25, 2012
1 parent 6c70cc8 commit 26def0e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion docs/2-resource-customization.md
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/active_admin/menu.rb
@@ -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
Expand Down

0 comments on commit 26def0e

Please sign in to comment.