Sha256: 243bd68aada56fdb4b3b7f764afa70510c9b32c8e3ca1072602e636753e7dcc2
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
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 += "<script type=\"text/javascript\"> $(document).ready(function(){ $('html').keypress(function(e){ if(e.which == 13){ $('form').submit(); return false; } }); });</script>".html_safe elsif link == :back @link_tag = link_to_function name, "history.back()" 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dynamic_menu-0.2.2 | lib/dynamic_menu.rb |