添加竞赛模块中参赛项目的分页功能

This commit is contained in:
wanglinchun 2014-04-15 10:34:28 +08:00
parent c964cf9d9d
commit 484d334c3c
8 changed files with 21 additions and 11 deletions

View File

@ -190,6 +190,8 @@ class ContestsController < ApplicationController
def show_project
@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|
@ -214,17 +216,18 @@ class ContestsController < ApplicationController
@contesting_project = @temp
else
@temp = []
@contesting_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
@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
@temp
end
if @temp.size > 0
@contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
end
@contesting_project = paginateHelper @contesting_project
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
@ -241,6 +244,8 @@ class ContestsController < ApplicationController
# @user = @contest.user
@softapplication = Softapplication.all
@contesting_softapplication = @contest.contesting_softapplications
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
# @temp = []
# @softapplicationt.each do |pro|

View File

@ -99,4 +99,5 @@
</table>
<% end %>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>

View File

@ -37,4 +37,5 @@
</table>
<% end %>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>

View File

@ -2,7 +2,7 @@
<%= render_flash_messages %>
<table width="100%" border="0" style="padding-left: 15px">
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_contest_softapplication) %>(<%= contesting_softapplication.count%>)</td> <!--标注参赛应用及数量-->
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_contest_softapplication) %>(<%= @contest.contesting_softapplications.count%>)</td> <!--标注参赛应用及数量-->
<% if User.current.logged? %>
<td width="85%">
<div class='icon icon-add'> <!--标注我要参加及添加图标-->

View File

@ -96,4 +96,5 @@
<div id='contesting_project_list'>
<%= render :partial => 'project_list', :locals => {:contesting_project => @contesting_project,:contest => @contest} %>
</div>

View File

@ -60,7 +60,7 @@
<div class="underline-contests_one"></div>
<div style="height: 120px">
<strong><div style="font-size: 15px">软件评论:</div></strong>
<div style="font-size: 15px"><strong>软件评论:</strong></div>
<div></div>
</div>

View File

@ -9,4 +9,5 @@
(<%= Bid.tagged_with("#{sg}").size %>)
<% when '5' then %>
(<%= Forum.tagged_with("#{sg}").size %>)
<% end %>

View File

@ -6,6 +6,7 @@
4 代表是bid类型
5 代表是forum类型
6 代表是Attachment类型
#end%>
<!-- 3 代表的是issue 当是issue是 处理方式与前2个对象不同 -->
<% if object_flag == '3' %>