=Dynamic Menu ==Introduction Dynamic Menu is a gem to make it easy to add a custom menu to your application via a controller. == Install You need to add: gem "dynamic_menu" to your gemfile if you would like the latest stable version if you would like the latest version (could be broke at download) you can add this line to your gemfile: gem "dynamic_menu",:git=>"git://github.com/plowdawg/dynamic_menu.git" == How to use ===Option1 You can create an array in a controller like so: @actionMenuItem = Array.new option1 = DynamicMenu::ActionMenuItem.new("Name",link_to_path) @actionMenuItem[0] = option1 then you can refrence it by using a loop such as @actionMenuItem.each do |menu| menu.link_tag #this generates the entire link end if you need a delete and confirmation method then you can declare it like so: option1 = DynamicMenu::ActionMenuItem.new("Link Name", link_to_path, :delete, "Are you sure?") the first is what the link will look like on the view, second is the view, third is the method (only works for delete) and the fourth is the confirmation method (which also only works on delete) ===Option2 Like Option1 except in your controller you can declare include DynamicForm right underneath the class like so: class SomeController < ApplicationController include DynamicMenu then instead of using DynamicMenu::ActionMenuItem.new you can use ActionMenuItem.new ==Tips To prevent long code you can no arrays like so: @actionMenuItems = Array.new @actionMenuItems << ActionMenuItem.new("Link",link_path) ==Updates As of 0.2.0 you can now make a custom submit link via the Dynamic Menu. It is buggy in 0.2.0 so we recommend that you use 0.2.1 if you would like to do this. This option requires you to be using JQuery or somehow reference it, as the code to detect the enter key runs with its syntax. To make a link that acts like a submit button simply use :submit as a link. As of 0.2.2 you can use :back as link because it will load a javascript to get you back For example: @actionMenuItems << ActionMenuItem.new("Submit Form",:submit)