|
|
@ -31,8 +31,8 @@ module WatchersHelper
|
|
|
|
|
|
|
|
|
|
|
|
watched = objects.any? {|object| object.watched_by?(user)}
|
|
|
|
watched = objects.any? {|object| object.watched_by?(user)}
|
|
|
|
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
|
|
|
|
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid)))
|
|
|
|
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon' : 'icon'].join(' ')) :
|
|
|
|
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon joinButton' : 'icon joinButton'].join(' ')) :
|
|
|
|
([watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' '))
|
|
|
|
([watcher_css(objects), watched ? 'icon icon-fav joinButton' : 'icon icon-fav-off joinButton'].join(' '))
|
|
|
|
|
|
|
|
|
|
|
|
text = @watch_flag ?
|
|
|
|
text = @watch_flag ?
|
|
|
|
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
|
|
|
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
|
|
@ -46,7 +46,7 @@ module WatchersHelper
|
|
|
|
link_to text, url, :remote => true, :method => method, :class => css
|
|
|
|
link_to text, url, :remote => true, :method => method, :class => css
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# added by fq
|
|
|
|
# added by fq, modify nyan
|
|
|
|
def join_in_course(course, user)
|
|
|
|
def join_in_course(course, user)
|
|
|
|
return '' unless user && user.logged?
|
|
|
|
return '' unless user && user.logged?
|
|
|
|
joined = user.member_of?(course)
|
|
|
|
joined = user.member_of?(course)
|
|
|
@ -55,9 +55,9 @@ module WatchersHelper
|
|
|
|
url_f = try_join_path(:object_id => course.id)
|
|
|
|
url_f = try_join_path(:object_id => course.id)
|
|
|
|
method = joined ? 'delete' : 'post'
|
|
|
|
method = joined ? 'delete' : 'post'
|
|
|
|
if joined
|
|
|
|
if joined
|
|
|
|
link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure)
|
|
|
|
link_to text, url_t, :remote => true, :method => method, :id => 'join', :confirm => l(:text_are_you_sure), :class => 'joinButton'
|
|
|
|
else
|
|
|
|
else
|
|
|
|
link_to text, url_f, :remote => true, :method => method, :id => 'join'
|
|
|
|
link_to text, url_f, :remote => true, :method => method, :id => 'join', :class => 'joinButton'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|