@@ -5,22 +5,22 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | module WatchersHelper |
|
18 | module WatchersHelper | |
19 |
|
19 | |||
20 | def watcher_tag(object, user, options={}) |
|
20 | def watcher_tag(object, user, options={}) | |
21 | content_tag("span", watcher_link(object, user), :class => watcher_css(object)) |
|
21 | content_tag("span", watcher_link(object, user), :class => watcher_css(object)) | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
24 | def watcher_link(object, user) |
|
24 | def watcher_link(object, user) | |
25 | return '' unless user && user.logged? && object.respond_to?('watched_by?') |
|
25 | return '' unless user && user.logged? && object.respond_to?('watched_by?') | |
26 | watched = object.watched_by?(user) |
|
26 | watched = object.watched_by?(user) | |
@@ -32,14 +32,14 module WatchersHelper | |||||
32 | {:url => url}, |
|
32 | {:url => url}, | |
33 | :href => url_for(url), |
|
33 | :href => url_for(url), | |
34 | :class => (watched ? 'icon icon-fav' : 'icon icon-fav-off')) |
|
34 | :class => (watched ? 'icon icon-fav' : 'icon icon-fav-off')) | |
35 |
|
35 | |||
36 | end |
|
36 | end | |
37 |
|
37 | |||
38 | # Returns the css class used to identify watch links for a given +object+ |
|
38 | # Returns the css class used to identify watch links for a given +object+ | |
39 | def watcher_css(object) |
|
39 | def watcher_css(object) | |
40 | "#{object.class.to_s.underscore}-#{object.id}-watcher" |
|
40 | "#{object.class.to_s.underscore}-#{object.id}-watcher" | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | # Returns a comma separated list of users watching the given object |
|
43 | # Returns a comma separated list of users watching the given object | |
44 | def watchers_list(object) |
|
44 | def watchers_list(object) | |
45 | remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) |
|
45 | remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) |
General Comments 0
You need to be logged in to leave comments.
Login now