Module: ActionView::Helpers::PrototypeHelper
- Defined in:
- lib/yui-on-rails/prototype_helper.rb
Instance Method Summary collapse
- #form_remote_tag(options = {}, &block) ⇒ Object
- #link_to_remote(name, options = {}, html_options = nil) ⇒ Object
Instance Method Details
#form_remote_tag(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/yui-on-rails/prototype_helper.rb', line 12 def form_remote_tag( = {}, &block) [:before,:after,:loading, :loaded, :interactive,:success,:failure,:complete].each do |symb| .merge!({symb=>"yui_default_#{symb.to_s}()"}) unless .keys.include?(symb) end [:form] = true [:html] ||= {} [:html][:onsubmit] = ([:html][:onsubmit] ? [:html][:onsubmit] + "; " : "") + "#{remote_function()}; return false;" form_tag([:html].delete(:action) || url_for([:url]), [:html], &block) end |
#link_to_remote(name, options = {}, html_options = nil) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/yui-on-rails/prototype_helper.rb', line 4 def link_to_remote(name, = {}, = nil) #myopts = {} [:before,:after,:loading, :loaded, :interactive,:success,:failure,:complete].each do |symb| .merge!({symb=>"yui_default_#{symb.to_s}()"}) unless .keys.include?(symb) end #options.merge!({:before=>"default_before()",:complete=>"alert('completed')"}) link_to_function(name, remote_function(), || .delete(:html)) end |