diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-10 16:10:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-02-10 16:10:53 +0000 |
commit | deffd81ada7107dafabf701d3df70f31ca3c743a (patch) | |
tree | 6debea122cf3888c2ce5e86b8bca65b918ea6c20 /app | |
parent | 75129aaa1b12547c1d60b6bb8e0ae2c36483fcfe (diff) | |
download | redmine-deffd81ada7107dafabf701d3df70f31ca3c743a.tar.gz redmine-deffd81ada7107dafabf701d3df70f31ca3c743a.zip |
Use POST/DELETE to watch/unwatch an item.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11343 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/watchers_helper.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 3c27fc02d..4aab507bd 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -31,14 +31,13 @@ module WatchersHelper watched = objects.any? {|object| object.watched_by?(user)} css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') text = watched ? l(:button_unwatch) : l(:button_watch) - url = { - :controller => 'watchers', - :action => (watched ? 'unwatch' : 'watch'), + url = watch_path( :object_type => objects.first.class.to_s.underscore, :object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort) - } + ) + method = watched ? 'delete' : 'post' - link_to text, url, :remote => true, :method => 'post', :class => css + link_to text, url, :remote => true, :method => method, :class => css end # Returns the css class used to identify watch links for a given +object+ |