显示部分数据

This commit is contained in:
nieguanghui 2013-11-28 08:34:20 +08:00
parent 6dc692bb6a
commit 1f83ca612b
3 changed files with 120 additions and 236 deletions

View File

@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module WelcomeHelper
include ProjectsHelper
def newbieTopiclist
find_all_topic_by_board_id
@ -36,7 +35,19 @@ module WelcomeHelper
def find_all_hot_project
sort_project_by_hot
end
def find_all_hot_course
sort_course_by_hot
end
def find_all_hot_bid
sort_bid_by_hot
end
def find_all_hot_contest
sort_contest_by_hot
end
private
def search_project
@ -57,4 +68,40 @@ module WelcomeHelper
def find_project_by_board board
Project.find_by_id(board.project_id)
end
def sort_project_by_hot
return sort_project_by_hot_rails 0
end
def sort_course_by_hot
return sort_project_by_hot_rails 1
end
def sort_bid_by_hot
return sort_bid_by_hot_rails 1
end
def sort_contest_by_hot
return sort_bid_by_hot_rails 2
end
def sort_project_by_hot_rails project_type
limit = 10
project_type == 0 ? Project.find_by_sql("
SELECT p.id, p.name, p.description, p.identifier, t.project_id
FROM projects AS p RIGHT OUTER JOIN (
SELECT project_id,grade FROM project_statuses
WHERE project_type = #{project_type} ORDER BY grade DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
: Project.find_by_sql("
SELECT p.id, p.name, p.description, p.identifier, t.project_id
FROM projects AS p RIGHT OUTER JOIN (
SELECT project_id,grade FROM project_statuses
WHERE project_type = #{project_type} ORDER BY course_ac_para DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
end
def sort_bid_by_hot_rails reward_type
limit = 10
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit).all
end
end

View File

@ -119,7 +119,7 @@
</div> -->
<div class="left" style="float: left; height: 445px;">
<div class="left" style="float: left; height: 445px;">
<ul class="welcome-message-list" style="width: 90%;">
<h3 style="">论坛热帖</h3>
<div class="welcome-box-list">
@ -145,8 +145,7 @@
</ul>
</div>
<div class="right" style="float: right; margin-right: -80px; height: 445px;">
<div class="right" style="float: right; margin-right: -80px; height: 445px;">
<ul class="user-welcome-message-list" style="width: 80%; margin-top: 80px;">
<h3 style="margin-left: -5px;">用户动态</h3>
<div class="user-message-box-list">
@ -200,7 +199,7 @@
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h2>热门项目</h2>
<h2>热门项目</h2>
<!-- <ul class="d-p-index-hdright d-p-project-bytime ks-switchable-nav">
<li class="current">
<a class="" href="javascript:void(0);">今日</a>
@ -214,53 +213,25 @@
</ul> -->
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<li style="background-image:none;">
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tfs/" title="tfs">DIV布局测试</a>
</p>
<p class="layout-1" >
<span class="d-p-project-intro">给大家一个版本库路径为trustie2@10.0.47.245:/home/trustie2密码是http://10.0.47.245/trustie21234</span>
</p>
<!-- <span>更新于</span><span style="color: blue">5天前</span> -->
</li>
<li>
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/javatwx/" title="javatwx">javatwx</a>
</p>
<p class="layout-1">
<span class="d-p-project-intro">javamall</span>
</p>
</li>
<li>
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/sz_digital_ocean/" title="sz_digital_ocean">sz_digital_ocean</a>
</p>
<p class="layout-1">
<span class="d-p-project-intro">sz_digital_ocean</span>
</p>
</li>
<li>
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/android_1/" title="android_1">android_1</a>
</p>
<p class="layout-1">
<span class="d-p-project-intro">android study</span>
</p>
</li>
<li>
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tair/" title="tair">tair</a>
</p>
<p class="layout-1">
<span class="d-p-project-intro">Tair is a distributed, high performance key/value storage sy...</span>
</p>
</li>
</ul>
</div>
</div>
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[5]) %>
<li style="background-image:none;">
<p class="layout">
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%>
</p>
<p class="layout-1" >
<span class="d-p-project-intro"><%= project.description %></span>
</p>
<!-- <p class="layout">
<span><%= project.members.count%></span>
</p> -->
</li>
<% end %>
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h2>热门竞赛</h2>
<h2>热门竞赛</h2>
<!-- <ul class="d-p-index-hdright d-p-project-bytime ks-switchable-nav">
<li class="current">
<a class="" href="javascript:void(0);">今日</a>
@ -272,71 +243,27 @@
<a class="" href="javascript:void(0);">本月</a>
</li>
</ul> -->
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="background-image:none;">
<p class="layout">
<%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{contest.name}")%>
</p>
<p class="layout-1" >
<span class="d-p-project-intro"><%= contest.description %></span>
</p>
<!-- <p style="margin-top: -10px;">
<span><%= contest.created_on %></span>
</p> -->
</li>
<% end %>
</ul>
</div>
</div>
<li style="background-image:none;" >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tfs/" title="tfs">tfs</a>
</p>
<p class="layout">
<span class="d-p-project-intro">TFSTaobao FileSystem是一个高可扩展、高可用、高性能、面向互联网服务的分布式文件系统其设计目标是...</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/javatwx/" title="javatwx">javatwx</a>
</p>
<p class="layout">
<span class="d-p-project-intro">javamall</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/sz_digital_ocean/" title="sz_digital_ocean">sz_digital_ocean</a>
</p>
<p class="layout">
<span class="d-p-project-intro">sz_digital_ocean</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/android_1/" title="android_1">android_1</a>
</p>
<p class="layout">
<span class="d-p-project-intro">android study</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tair/" title="tair">tair</a>
</p>
<p class="layout">
<span class="d-p-project-intro">Tair is a distributed, high performance key/value storage sy...</span>
</p>
</li>
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" >
<h2>最新众包</h2>
<h2>最新众包</h2>
<!-- <ul class="d-p-index-hdright d-p-project-bytime ks-switchable-nav">
<li class="current">
<a class="" href="javascript:void(0);">今日</a>
@ -348,71 +275,24 @@
<a class="" href="javascript:void(0);">本月</a>
</li>
</ul> -->
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<li style="background-image:none;" >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tfs/" title="tfs">tfs</a>
</p>
<p class="layout">
<span class="d-p-project-intro">TFSTaobao FileSystem是一个高可扩展、高可用、高性能、面向互联网服务的分布式文件系统其设计目标是...</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/javatwx/" title="javatwx">javatwx</a>
</p>
<p class="layout">
<span class="d-p-project-intro">javamall</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/sz_digital_ocean/" title="sz_digital_ocean">sz_digital_ocean</a>
</p>
<p class="layout">
<span class="d-p-project-intro">sz_digital_ocean</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/android_1/" title="android_1">android_1</a>
</p>
<p class="layout">
<span class="d-p-project-intro">android study</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tair/" title="tair">tair</a>
</p>
<p class="layout">
<span class="d-p-project-intro">Tair is a distributed, high performance key/value storage sy...</span>
</p>
</li>
</ul>
</div>
</div>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
<li style="background-image:none;">
<p class="layout">
<%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{bid.name}")%>
</p>
<p class="layout-1" >
<span class="d-p-project-intro"><%= bid.description %></span>
</p>
</li>
<% end %>
</ul>
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h2>热门课程</h2>
<h2>热门课程</h2>
<!-- <ul class="d-p-index-hdright d-p-project-bytime ks-switchable-nav">
<li class="current">
<a class="" href="javascript:void(0);">今日</a>
@ -426,65 +306,21 @@
</ul> -->
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<li style="background-image:none;" >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tfs/" title="tfs">tfs</a>
</p>
<p class="layout">
<span class="d-p-project-intro">TFSTaobao FileSystem是一个高可扩展、高可用、高性能、面向互联网服务的分布式文件系统其设计目标是...</span>
</p>
</li>
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
<li style="background-image:none;">
<p class="layout">
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%>
</p>
<p class="layout-1" >
<span class="d-p-project-intro"><%= project.description %></span>
</p>
</li>
<% end %>
</ul>
</div>
</div>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/javatwx/" title="javatwx">javatwx</a>
</p>
<p class="layout">
<span class="d-p-project-intro">javamall</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/sz_digital_ocean/" title="sz_digital_ocean">sz_digital_ocean</a>
</p>
<p class="layout">
<span class="d-p-project-intro">sz_digital_ocean</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/android_1/" title="android_1">android_1</a>
</p>
<p class="layout">
<span class="d-p-project-intro">android study</span>
</p>
</li>
<li >
<p class="layout">
<a target="_blank" class="d-g-blue d-p-project-name" href="/p/tair/" title="tair">tair</a>
</p>
<p class="layout">
<span class="d-p-project-intro">Tair is a distributed, high performance key/value storage sy...</span>
</p>
</li>
</ul>
</div>
</div>
<div class="clr"></div>
<div class="clr"></div>
</div>

View File

@ -593,6 +593,7 @@ ul.tool li{list-style-type:none;
.welcome_right{
float:right;
width: 49%;
padding-left: 30px;
}
.inf_user_motto{