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
pull/351/head
Jean-Philippe Lang 17 years ago
parent 0f5a34b7ab
commit b29b39290a
  1. 8
      app/controllers/watchers_controller.rb

@ -23,18 +23,22 @@ class WatchersController < ApplicationController
user = User.current
@watched.add_watcher(user)
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)} }
end
rescue RedirectBackError
render :text => 'Watcher added.', :layout => true
end
def remove
user = User.current
@watched.remove_watcher(user)
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)} }
end
rescue RedirectBackError
render :text => 'Watcher removed.', :layout => true
end
private

Loading…
Cancel
Save