Forum: Ruby on Rails Refactoring RJS

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.
F677fa685a2cfe8aff31f161062db3d3?d=identicon&s=25 David (Guest)
on 2009-02-11 11:41
(Received via mailing list)
I have some RJS that could use some refactoring.  I use the function
called with afterFinish twice and Im wondering what the best way to
refactor is. This is all inline rjs in the controller mind you:

          page.visual_effect :slide_down, "add_appt_#{params
[:day]}", :afterFinish => "function(){
      $('end_drop_#{params[:day]}_#{params
[:appt_counter]}').style.display = 'block';
      $('end_drop_#{params[:day]}_#{params
[:appt_counter]}').style.visibility = 'hidden';
      $('start_drop_#{params[:day]}_#{params
[:appt_counter]}').style.display = 'block';
      $('start_drop_#{params[:day]}_#{params
[:appt_counter]}').style.visibility = 'hidden';
          }"
This topic is locked and can not be replied to.