diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-13 19:43:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-05-13 19:43:35 +0000 |
commit | bca5bd9c62769ca85f00259ac0e9a3c4538f7051 (patch) | |
tree | a14630132f58878681cc416aa86b20a8d448923c /app/helpers/watchers_helper.rb | |
parent | b90e84b9fe252df464d084f0222c65367407a4ba (diff) | |
download | redmine-bca5bd9c62769ca85f00259ac0e9a3c4538f7051.tar.gz redmine-bca5bd9c62769ca85f00259ac0e9a3c4538f7051.zip |
Added watchers for message boards (watchers controller modified to support any watchable model).
No notification yet when a new message is posted.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@530 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/watchers_helper.rb')
-rw-r--r-- | app/helpers/watchers_helper.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 23f767611..87b381055 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -16,4 +16,21 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module WatchersHelper + def watcher_tag(object, user) + content_tag("span", watcher_link(object, user), :id => 'watcher') + end + + def watcher_link(object, user) + return '' unless user && object.respond_to?('watched_by?') + watched = object.watched_by?(user) + url = {:controller => 'watchers', + :action => (watched ? 'remove' : 'add'), + :object_type => object.class.to_s.underscore, + :object_id => object.id} + link_to_remote((watched ? l(:button_unwatch) : l(:button_watch)), + {:url => url}, + :href => url_for(url), + :class => (watched ? 'icon icon-fav' : 'icon icon-fav-off')) + + end end |