This is the code that I use in rails 2
<%= link_to_remote image_tag("icon_edit.png", :onmouseover=>"$(this).up('.tooltip-wrapper').down('.tooltip-wrapper-box').show()",:onmouseout=>"$(this).up('.tooltip-wrapper').down('.tooltip-wrapper-box').hide()" ).html_safe, :url => { :controller =>'/resume/contact_detail',:action => 'edit_contact_detail'}, :html => { :class => "link_grey" },:before => "$('edit_contact_link').hide();show_spinner('view_contact_detail','view_contact_detail_spinner')" %>
How can I make it to rails 3 ?
I am new to unobtrusive javascript so someone can help me in converting this ?
I tried using the following :
<%= link_to :url => { :controller =>'/resume/contact_detail',:action => 'edit_contact_detail'}, :remote=>true do %>
<%= image_tag('icon_edit.png', :onmouseover=>"$(this).up('.tooltip-wrapper').down('.tooltip-wrapper-box').show()",:onmouseout=>"$(this).up('.tooltip-wrapper').down('.tooltip-wrapper-box').hide()") %>
<% end %>
But I am missing the :before option 🙁
Thank you
Instead of using
:beforeas you would do in Rails 2.X, define it as a:onclick.The
onclickevent should be run before the:remotecall.See my comment on your question as to why the remote part isn’t running.