comparison app/controllers/.svn/text-base/watchers_controller.rb.svn-base @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children
comparison
equal deleted inserted replaced
451:a9f6345cb43d 511:107d36338b70
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
74 render_404 74 render_404
75 end 75 end
76 76
77 def set_watcher(user, watching) 77 def set_watcher(user, watching)
78 @watched.set_watcher(user, watching) 78 @watched.set_watcher(user, watching)
79 if params[:replace].present?
80 if params[:replace].is_a? Array
81 replace_ids = params[:replace]
82 else
83 replace_ids = [params[:replace]]
84 end
85 else
86 replace_ids = ['watcher']
87 end
88 respond_to do |format| 79 respond_to do |format|
89 format.html { redirect_to :back } 80 format.html { redirect_to :back }
90 format.js do 81 format.js do
91 render(:update) do |page| 82 render(:update) do |page|
92 replace_ids.each do |replace_id| 83 c = watcher_css(@watched)
93 page.replace_html replace_id, watcher_link(@watched, user, :replace => replace_ids) 84 page.select(".#{c}").each do |item|
85 page.replace_html item, watcher_link(@watched, user)
94 end 86 end
95 end 87 end
96 end 88 end
97 end 89 end
98 rescue ::ActionController::RedirectBackError 90 rescue ::ActionController::RedirectBackError