Module: ActionView::Helpers::PrototypeHelper

Defined in:
lib/yui-on-rails/prototype_helper.rb

Instance Method Summary collapse

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(options = {}, &block)
  [:before,:after,:loading, :loaded, :interactive,:success,:failure,:complete].each do |symb|
    options.merge!({symb=>"yui_default_#{symb.to_s}()"}) unless options.keys.include?(symb)
  end
  options[:form] = true
  options[:html] ||= {}
  options[:html][:onsubmit] =
    (options[:html][:onsubmit] ? options[:html][:onsubmit] + "; " : "") +
    "#{remote_function(options)}; return false;"

  form_tag(options[:html].delete(:action) || url_for(options[:url]), options[:html], &block)
end


4
5
6
7
8
9
10
11
# File 'lib/yui-on-rails/prototype_helper.rb', line 4

def link_to_remote(name, options = {}, html_options = nil)
  #myopts = {}
  [:before,:after,:loading, :loaded, :interactive,:success,:failure,:complete].each do |symb|
    options.merge!({symb=>"yui_default_#{symb.to_s}()"}) unless options.keys.include?(symb)
  end
  #options.merge!({:before=>"default_before()",:complete=>"alert('completed')"})
  link_to_function(name, remote_function(options), html_options || options.delete(:html))
end