Redirects back after clicking watch/unwatch links without javascript (#1337).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1607 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
0f5a34b7ab
commit
b29b39290a
|
@ -23,18 +23,22 @@ class WatchersController < ApplicationController
|
||||||
user = User.current
|
user = User.current
|
||||||
@watched.add_watcher(user)
|
@watched.add_watcher(user)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :text => 'Watcher added.', :layout => true }
|
format.html { redirect_to :back }
|
||||||
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
|
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
|
||||||
end
|
end
|
||||||
|
rescue RedirectBackError
|
||||||
|
render :text => 'Watcher added.', :layout => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove
|
def remove
|
||||||
user = User.current
|
user = User.current
|
||||||
@watched.remove_watcher(user)
|
@watched.remove_watcher(user)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :text => 'Watcher removed.', :layout => true }
|
format.html { redirect_to :back }
|
||||||
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
|
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
|
||||||
end
|
end
|
||||||
|
rescue RedirectBackError
|
||||||
|
render :text => 'Watcher removed.', :layout => true
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Reference in New Issue