Browse Source

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
tags/0.8.0-RC1
Jean-Philippe Lang 16 years ago
parent
commit
b29b39290a
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      app/controllers/watchers_controller.rb

+ 6
- 2
app/controllers/watchers_controller.rb View File

@@ -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