module DynamicMenu
class ActionMenuItem
include ActionView::Helpers::UrlHelper
include ActionView::Helpers::JavaScriptHelper
attr_accessor :name, :link, :method, :link_tag
def initialize(name, link , method = :get, confirm="Are You Sure?")
@name = name
@link = link
@method = method
@link_tag = ""
if method == :delete
@link_tag = link_to name, link, :method=>method, :confirm=>confirm
else
if link == :submit
#make it easy to include a submit button via link...for enter support...requires
#JQUERY!!!
@link_tag = link_to_function name, "$('form').submit()"
@link_tag += "".html_safe
elsif link == :back
@link_tag = "#{name}".html_safe
@link_tag += "".html_safe
else
@link_tag = link_to name, link
end #end if submit
end #end if delete
end #end initalize
end #end actionmenu Item
end #end Modlue