This commit is contained in:
nieguanghui 2013-11-28 16:00:53 +08:00
parent cc9dca4012
commit 90b38cf5e8
3 changed files with 25 additions and 54 deletions

View File

@ -47,6 +47,10 @@ module WelcomeHelper
def find_all_hot_contest
sort_contest_by_hot
end
def time_tag_welcome(time)
text = distance_of_time_in_words(Time.now, time)
content_tag('span', text, :title => format_time(time))
end
private
@ -85,7 +89,7 @@ module WelcomeHelper
sort_bid_by_hot_rails 2
end
#取得所有活动
def find_all_activities limit=10
def find_all_activities limit=5
# users = []
# activities = Activity.find_by_sql("select distinct user_id from activities order by id DESC limit #{limit}" )
# activities.each { |activity|
@ -102,7 +106,7 @@ module WelcomeHelper
Memo.order('replies_count DESC').where('replies_count <> 0').limit(limit)
end
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=10
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15
Project.find_by_sql("
SELECT p.id, p.name, p.description, p.identifier, t.project_id
FROM projects AS p RIGHT OUTER JOIN (

View File

@ -97,74 +97,36 @@
<%= stylesheet_link_tag 'welcome' %>
<div class="body_resize">
<!-- <div class="right">
<div class="home"><%= l :label_hot_project%></div>
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[5]) %>
<div class="project">
<%=link_to( project.name, project_path(project.project_id), :class => "nowrap" )%>
<p><%= project.description %></p>
</div>
<% end %>
</div>
</div>
<div class="left">
<div class="home" ><%= l :label_newbie_faq %></div>
<% newbieTopicStickyList.each do |topic| break if(topic == newbieTopicStickyList[6])%>
<div class="project">
<%=link_to( topic.subject, board_message_path(find_board_by_topic(topic),topic), :class => "nowrap" )%>
<span class="grey"><strong><em>[ <%=find_project_by_topic(topic) %> ]</em></strong></span>
</div>
<% end %>
</div> -->
<div class="left" style="float: left; height: 445px;">
<div class="left" style="float: left; height: 445px; width: 50%;">
<ul class="welcome-message-list" style="width: 90%;">
<h3 style="">论坛热帖</h3>
<div class="welcome-box-list">
<% find_hot_forum_topics.each do |topic|%>
<li class="message-brief-intro">
<span style="color:gray"><%= topic.subject %></span>
<span style="color:gray"><%= link_to topic.subject.truncate(30, omission: '...'), forum_memo_path(topic.forum_id,topic.id) %></span>
<span style="margin-left: 10px; color: green">
<%= link_to topic.author, user_path(topic.author) %>
</span>
<span style="margin-left:10px; color:blue"><%= time_tag topic.created_at %></span>
<span style="margin-left:10px; color:blue"><%= time_tag_welcome topic.created_at %>前</span>
</li>
<% end %>
<li class="message-brief-intro">
<span style="color:gray">热烈祝贺论坛新版本上线欢迎大家提交bug</span><span style="margin-left: 10px; color: green">yanpc</span><span style="margin-left:10px; color:blue">5分钟前</span>
</li>
<li class="message-brief-intro">
<span style="color:gray">论坛全新改版增加许多功能啦欢迎大家提交bug</span><span style="margin-left: 10px; color: green">yanpc</span><span style="margin-left:10px; color:blue">半小时前</span>
</li>
<li class="message-brief-intro">
<span style="color:gray">网站主页改版,欢迎大家提交意见和建议</span><span style="margin-left: 10px; color: green">yanpc</span><span style="margin-left:10px; color:blue">2013-11-12</span>
</li>
<li class="message-brief-intro">
<span style="color:gray">网站持续更新中,以期给大家带来更好的用户体验</span><span style="margin-left: 10px; color: green">yanpc</span><span style="margin-left:10px; color:blue">2013-11-9</span>
</li>
<li class="message-brief-intro">
<span style="color:gray">网站上线第一次发帖,欢迎大家来盖楼</span><span style="margin-left: 10px; color: green">yanpc</span><span style="margin-left:10px; color:blue">2013-11-9</span>
</li>
</div>
</ul>
</div>
<div class="right" style="float: right; margin-right: -80px; height: 445px;">
<div class="right" style="float: right; margin-right: -10px; height: 445px; width: 50%; ">
<ul class="user-welcome-message-list" style="width: 80%; margin-top: 80px;">
<h3 style="margin-left: -5px;">用户动态</h3>
<div class="user-message-box-list">
<% find_all_activities.each do |event| %>
<li style="display: block;height:60px;">
<div class="inner-right" style="float: left; height: 100%;">
<img class="avatar-3" style="width: 40px; height: 40px; margin-top:10px;" src="/images/avatars/User/4861?1385345302"></img>
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
</div>
<div class="inner-right" style="float: right; width:88%; height: 100%;">
<span style="color: green;"><%= event.event_author %></span>&nbsp;发表了评论:<span style="color: blue;"><%= truncate(event.event_description, length: 15, omission:'...') %>
<span style="color: green;"><%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %></span>&nbsp;发表了<%= event.event_type %><span style="color: blue;"><%= link_to truncate(event.event_description, length: 30, omission:'...'), event.event_url %>
</span>
<p><span><%= time_tag event.event_datetime %></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>评论(4)</span></p>
<p><span><%= time_tag_welcome event.event_datetime %></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<!-- <span>评论(4)</span></p> -->
</div>
</li>
<% end %>
@ -187,13 +149,13 @@
</ul> -->
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[5]) %>
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %>
<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.truncate(50, omission: '... (continued)') %></span>
<span class="d-p-project-intro" ><%= project.description.truncate(50, omission: '...') %></span>
</p>
<!-- <p class="layout">
<span><%= project.members.count%></span>
@ -225,7 +187,7 @@
<%= 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.truncate(50, omission: '... (continued)') %></span>
<span class="d-p-project-intro"><%= contest.description.truncate(50, omission: '...') %></span>
</p>
<!-- <p style="margin-top: -10px;">
<span><%= contest.created_on %></span>
@ -236,8 +198,8 @@
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" >
<h2>最新众包</h2>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<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>
@ -257,7 +219,7 @@
<%= 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.truncate(50, omission: '... (continued)') %></span>
<span class="d-p-project-intro"><%= bid.description.truncate(50, omission: '...') %></span>
</p>
</li>
<% end %>
@ -286,7 +248,7 @@
<%= 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.truncate(50, omission: '... (continued)') %></span>
<span class="d-p-project-intro"><%= project.description.truncate(50, omission: '...') %></span>
</p>
</li>
<% end %>

View File

@ -192,7 +192,12 @@ p.layout {
}
.avatar-3 {
width: 40px; height: 40px; margin-top:10px;
width: 40px;
height: 40px;
margin-top: 5px;
}
acronym {
text-decoration: none;
}
/*p.clr, .clr { clear:both; padding:0; margin:0; background:none;}*/