目前已经通过判断将属于竞赛的项目或是应用显示到我要参赛的作品列表中
This commit is contained in:
parent
f2dbbc48fc
commit
538f8516b0
|
@ -253,6 +253,7 @@ class ContestsController < ApplicationController
|
|||
############
|
||||
##显示参赛的应用
|
||||
def show_softapplication
|
||||
|
||||
# @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
# @option = []
|
||||
|
||||
|
@ -292,10 +293,53 @@ class ContestsController < ApplicationController
|
|||
|
||||
###我要参赛
|
||||
def show_attendingcontest
|
||||
##取出参赛项目
|
||||
@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@option = []
|
||||
# @contesting_project_count = @contesting_project_all.count
|
||||
# @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
|
||||
}
|
||||
end
|
||||
end
|
||||
@user = @contest.author
|
||||
@contesting_project = @contest.contesting_projects.all
|
||||
if params[:student_id].present?
|
||||
@temp = []
|
||||
@contesting_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id
|
||||
@temp << pro
|
||||
end
|
||||
end
|
||||
@temp
|
||||
end
|
||||
@contesting_project = @temp
|
||||
else
|
||||
|
||||
@temp = []
|
||||
@contesting_project.each do |pro|
|
||||
if pro.project && pro.project.project_status
|
||||
@temp << pro
|
||||
end
|
||||
@temp
|
||||
end
|
||||
if @temp.size > 0
|
||||
@contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
|
||||
end
|
||||
end
|
||||
##取出参赛应用
|
||||
@softapplication = Softapplication.all
|
||||
@contesting_softapplication = @contest.contesting_softapplications
|
||||
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
|
||||
##引用base_newcontest整体样式
|
||||
|
||||
|
||||
##引用base_newcontest整体样式
|
||||
@contest = Contest.find_by_id(params[:id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
|
|
@ -55,11 +55,11 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<!---->
|
||||
<!--参赛步骤-->
|
||||
<div style="padding-left: 17px; padding-bottom: 15px">温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!</div>
|
||||
<% if User.current.logged? %>
|
||||
|
||||
<div>
|
||||
<div style="padding-bottom: 20px; line-height: 25px">
|
||||
<div style="padding-left: 17px; font-size: 15px"><strong>参赛步骤:</strong></div>
|
||||
<div style="padding-left: 82px; ">
|
||||
<span style="padding-top: 50px">步骤1:</span>
|
||||
|
@ -100,15 +100,49 @@
|
|||
|
||||
<% end %>
|
||||
|
||||
<!--参赛作品列表,通过判断,竞赛的id为2,3,6的则跳转到partial=> "list_projects", 否则跳转到-->
|
||||
<!--参赛作品列表,通过判断,竞赛的id为2,3,6的显示参赛作品为提交的项目,否则显示参赛的应用-->
|
||||
|
||||
<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %>
|
||||
|
||||
<% @contesting_softapplication.each do |c_softapplication|%>
|
||||
<% @contesting_project.each do |c_project|%>
|
||||
<% if c_project.project %>
|
||||
<div style="padding-left: 18px">
|
||||
<div style="font-size: 15px">
|
||||
<tr>
|
||||
<td><strong>参赛作品: </strong></td>
|
||||
<td>
|
||||
<%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %>
|
||||
</td>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px">
|
||||
<tr>
|
||||
<td>简介:</td>
|
||||
<td>
|
||||
<%= c_project.project.description.truncate(90, omission: '...') %>
|
||||
</td>
|
||||
</tr></br>
|
||||
</div>
|
||||
<div style="padding-left: 68px; padding-bottom: 8px">
|
||||
<tr>
|
||||
<td>发布时间:</td>
|
||||
<td>
|
||||
<%= format_time c_project.created_at%>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="underline-contests_three"></div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% @contesting_softapplication.each do |c_softapplication|%>
|
||||
<% if c_softapplication.softapplication %>
|
||||
<div style="padding-left: 18px">
|
||||
<div style="font-size: 15px">
|
||||
<tr>
|
||||
<td><strong>应用软件:</strong></td>
|
||||
<td><strong>参赛作品: </strong></td>
|
||||
<td>
|
||||
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %>
|
||||
</td>
|
||||
|
@ -134,7 +168,9 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<div class="underline-contests_three"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue