# HG changeset patch # User Chris Cannam # Date 1358266080 0 # Node ID 00e9a262ffe5c2c7db4aede8865df6421d9fa0c2 # Parent 13ab8b6e813288ec0a9996b913d7e59b0104b436 Fix Javascript so as to update star properly diff -r 13ab8b6e8132 -r 00e9a262ffe5 app/views/attachments/toggle_active.html.erb --- a/app/views/attachments/toggle_active.html.erb Tue Jan 15 15:55:45 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -<%= -file = Attachment.find(params[:id]) -active_id = "active-" + file.id.to_s -link_to_remote image_tag(file.active? ? 'fav.png' : 'fav_off.png'), - :url => {:controller => 'attachments', :action => 'toggle_active', :project_id => @project.id, :id => file}, - :update => active_id -%> diff -r 13ab8b6e8132 -r 00e9a262ffe5 app/views/attachments/toggle_active.js.erb --- a/app/views/attachments/toggle_active.js.erb Tue Jan 15 15:55:45 2013 +0000 +++ b/app/views/attachments/toggle_active.js.erb Tue Jan 15 16:08:00 2013 +0000 @@ -1,2 +1,1 @@ -$('#active-<$= @attachment.id $>').html("This is a test"); - +$('#active-<%= @attachment.id %>').html('<%= link_to image_tag(@attachment.active? ? 'fav.png' : 'fav_off.png'), {:controller => 'attachments', :action => 'toggle_active', :project_id => @project.id, :id => @attachment}, :remote => true %>');