Forum: Ruby on Rails different mouse event when using link_to_remote

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Steven (Guest)
on 2007-03-09 21:27
Anybody a have better method for having an onmouseover (or any event).
This is the method  used but its not as pretty and has to be done for
every mouse event.


      def link_to_remote_mover(name, options = {}, html_options = {})
        link_to_function_mover(name, remote_function(options),
html_options)
      end

      def link_to_function_mover(name, *args, &block)
        html_options = args.last.is_a?(Hash) ? args.pop : {}
        function = args[0] || ''
        html_options.symbolize_keys!
        function = update_page(&block) if block_given?
        content_tag(
          "a", name,
          html_options.merge({
            :href => html_options[:href] || "javascript:void(0)",
            :onmouseover => (html_options[:onmouseover] ?
"#{html_options[:onmouseover]}; " : "") + "#{function}; return false;"
          })
        )
      end
This topic is locked and can not be replied to.