Sha256: 034920e64d6fb2161f50a8045bf18d2f4db030eb0d3435048b822ae0360352be

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

# Dynamic Menu

This gem provides an easy way to generate a menu that changes according to the controller 
action.  It stores everything in an array which can later be accessed via the view.

#Getting Help

*Email me directly at support@pessetto.com and I will see what I can do

#Installation

The latest version, and probably the best to use, is 2.0.0 which no longer requires you to
manually declare the array.  To install just put the following in your Gemfile and run 
bundle install or bundle update:

```ruby
gem 'dynamic_menu','~>2.0.0'
```

Note: This gem was developed for Rails 3 and will most not work with anything under Rails 3.

##Getting Started

This gem features an engine that will automatically load it into your controllers.  However,
you will need to include in your views

```erb
<% @actionMenuItems.each do |menuitem|%>

<%= menuitem %>

<%end%>
```

Note: your array must be @actionMenuItems, do not define this in the controller, the Gem will
do it automatically for you unless you are using a pre-2.0 release.

To add a link in your menu from your controller it is just a matter of using newmenuitem()
Example

```ruby
def index

#...code here

newmenuitem("New Thing",new_thing_path)

#...code here
```

##Functions
There is only one function, newmenuitem, that this gem currently has, but can have various
values sent to it.

* newmenuitem(<string>name,<string>link) provides a regular get link to to link and displays name on the menu
* newmenuitem(<string>name,<string>link,:delete,<string>confirm) will send a delete request to link with the confirmation message of confirm
* newmenuitem(<string>name,:submit) will create a link to submit the form on the page assumming you don't want the regular button and listen for an enter via JavaScript

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynamic_menu-2.0.2 README.md
dynamic_menu-2.0.0 README.md