changeset 1158:00e9a262ffe5 redmine-2.2-integration

Fix Javascript so as to update star properly
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Tue, 15 Jan 2013 16:08:00 +0000
parents 13ab8b6e8132
children b619a667a8e8
files app/views/attachments/toggle_active.html.erb app/views/attachments/toggle_active.js.erb
diffstat 2 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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
-%>
--- 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 %>');