Sha256: 165467c41eb0159c784d4567a436d42aa7592dd813b4a022343ab82d904798b1
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
=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)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynamic_menu-0.2.1 | README.rdoc |
dynamic_menu-0.2.0 | README.rdoc |