修改竞赛中的role_id==xxx代码

This commit is contained in:
z9hang 2014-06-06 17:40:48 +08:00
parent cf5c7a6610
commit 47535ce101
1 changed files with 16 additions and 9 deletions

View File

@ -210,11 +210,14 @@ class ContestsController < ApplicationController
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
membership.member_roles.each{|role|
if(role.role_id == 3)
@option << membership.project
end
}
#membership.member_roles.each{|role|
# if(role.role_id == 3)
# @option << membership.project
# end
#}
if User.current.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
@option << membership.project
end
end
end
@user = @contest.author
@ -301,11 +304,15 @@ class ContestsController < ApplicationController
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
membership.member_roles.each{|role|
if(role.role_id == 3)
#membership.member_roles.each{|role|
#if(role.role_id == 3)
#@option << membership.project
#end
#}
#拥有编辑项目权限的可将该项目参赛
if User.current.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
@option << membership.project
end
}
end
end
end
@user = @contest.author