|
|
|
@ -43,7 +43,7 @@ module WatchersHelper
|
|
|
|
|
)
|
|
|
|
|
method = watched ? 'delete' : 'post'
|
|
|
|
|
|
|
|
|
|
link_to text, url, :remote => true, :method => method, :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 22px; line-height: 21px;padding-top:1px; background: none repeat scroll 0% 0% #64BDD9; TES"
|
|
|
|
|
link_to text, url, :remote => true, :method => method, :class => css
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
############## added by linchun
|
|
|
|
@ -278,11 +278,46 @@ module WatchersHelper
|
|
|
|
|
)
|
|
|
|
|
method = applied ? 'delete' : 'post'
|
|
|
|
|
|
|
|
|
|
link_to text, url, :remote => true, :method => method ,:style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px;padding-top:1px; background: none repeat scroll 0% 0% #64BDD9; TES"
|
|
|
|
|
link_to text, url, :remote => true, :method => method , :class => css
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def exit_project_link(project)
|
|
|
|
|
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
|
|
|
|
|
:remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES;padding-top:1px;" )
|
|
|
|
|
:remote => true, :confirm => l(:lable_sure_exit_project),
|
|
|
|
|
:style => "color: #fff; display:block; padding: 0px 5px; margin-right: 10px; height: 21px; line-height: 22px; background: none repeat scroll 0% 0% #64BDD9; TES;padding-top:1px;" )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#项目关注、取消关注
|
|
|
|
|
#REDO:项目样式确定后方法需要对CSS变量进行改进
|
|
|
|
|
def watcher_link_for_project(objects, user, options=[])
|
|
|
|
|
return '' unless user && user.logged?
|
|
|
|
|
objects = Array.wrap(objects)
|
|
|
|
|
watched = objects.any? {|object| object.watched_by?(user)}
|
|
|
|
|
@watch_flag = objects.first.instance_of?(Project)
|
|
|
|
|
text = @watch_flag ?
|
|
|
|
|
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_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 => method,
|
|
|
|
|
:class => "project_watch_new"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#申请加入项目
|
|
|
|
|
def join_in_project_link(project, user, options=[])
|
|
|
|
|
return '' unless user && user.logged?
|
|
|
|
|
applied = project.applied_projects.find_by_user_id(user.id)
|
|
|
|
|
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
|
|
|
|
|
@applied_flag = project.instance_of?(Project)
|
|
|
|
|
if applied
|
|
|
|
|
appliedid = applied.id
|
|
|
|
|
end
|
|
|
|
|
url = appliedproject_path(
|
|
|
|
|
:id=>appliedid,
|
|
|
|
|
:user_id => user.id,
|
|
|
|
|
:project_id => project.id)
|
|
|
|
|
method = applied ? 'delete' : 'post'
|
|
|
|
|
link_to text, url, :remote => true, :method => method , :class => "project_watch_new"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|