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