Refactoring RJS / Prototype Code in JQuery

I am struggling to find suitable alternatives to the methods in Prototype (conversion to JQuery) and wondered if you guys could suggest suitable replacements.

The RJS code I'm refactoring:

 if request.post? && @success
    page << "window.location.href='/news'"
 else
    page.replace_html :user_overlay, :partial => 'login'
      if @error_msg.blank?
        page.visual_effect :appear, 'user_overlay', :duration => '0.7'
    else
        page.replace_html 'overlay_messages', @error_msg
        page.visual_effect :highlight, 'overlay_messages', :startcolor => "#404040", :endcolor => "#666666"
    end

      

It loads via partial and replaces the elements in the [login errors] div, we run Ruby on Rails with JQuery.

0


a source to share


1 answer


I would recommend installing the jRails plugin .



I've been using it for a while with RJS without any of the problems I've ever had. A perfect fall in prototype replacement.

+2


a source







All Articles