Rails 1.2.6
I have a link_to_remote which uses graphic button for the display.
<%= link_to_remote '<img src="/controls/btn_narrativeHidden.gif" alt="" width="90" height="20" id="btnShowNarrative" />', :url => {:controller => 'narrative', :action => 'show'} %>
When that button is clicked, an RJS file adds content to a div and reveals it.
At the same time, I want that initial button to change. Essentially what my brain wants is for the whole link_to_remote code to change to this
<%= link_to_remote '<img src="/controls/btn_narrativeShown.gif" alt="" width="90" height="20" id="btnHideNarrative" />', :url => {:controller => 'narrative', :action => 'hide'} %>
So, when the button is clicked, its picture & its action both "toggle"
I can't figure out how to do that and the best way to architect the pieces.
I'm just getting started with using Ajax/RJS, and so far my RJS file is bare bones basics:
page.insert_html :top, 'narrative', "example text to insert" page.visual_effect :blind_down, 'narrative', :duration => 0.5
What would the RJS be to replace/modify that link_to_remote code ?
Any clues appreciated.
-- gw