Sha256: 38014cc88e64baf39e1f73d6bafa85debdbfe31132c76bb16be63e4b9dae1b90

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module ActionView
  module Helpers
    module PrototypeHelper
      def link_to_remote_with_yui(name, options = {}, html_options = nil)
        #myopts = {}
        [: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
      def form_remote_tag(options = {}, &block)
        [: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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yui-on-rails-0.1.10 lib/yui-on-rails/prototype_helper.rb