From 90b38cf5e80996a586d7575da08248c9543c5e9c Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Thu, 28 Nov 2013 16:00:53 +0800 Subject: [PATCH] s --- app/helpers/welcome_helper.rb | 8 +++- app/views/welcome/index.html.erb | 64 +++++++------------------------- public/stylesheets/welcome.css | 7 +++- 3 files changed, 25 insertions(+), 54 deletions(-) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 126366ff2..55f18459e 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -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 ( diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index e45f5bcc0..a4320c656 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -97,74 +97,36 @@ <%= stylesheet_link_tag 'welcome' %>
- - - -
+

    论坛热帖

    <% find_hot_forum_topics.each do |topic|%>
  • - <%= topic.subject %> + <%= link_to topic.subject.truncate(30, omission: '...'), forum_memo_path(topic.forum_id,topic.id) %> <%= link_to topic.author, user_path(topic.author) %> - <%= time_tag topic.created_at %> + <%= time_tag_welcome topic.created_at %>前
  • <% end %> -
  • - 热烈祝贺论坛新版本上线,欢迎大家提交bugyanpc5分钟前 -
  • -
  • - 论坛全新改版,增加许多功能啦,欢迎大家提交bugyanpc半小时前 -
  • -
  • - 网站主页改版,欢迎大家提交意见和建议yanpc2013-11-12 -
  • -
  • - 网站持续更新中,以期给大家带来更好的用户体验yanpc2013-11-9 -
  • -
  • - 网站上线第一次发帖,欢迎大家来盖楼yanpc2013-11-9 -
-
+

    用户动态

    <% find_all_activities.each do |event| %>
  • - <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
    - <%= event.event_author %> 发表了评论:<%= truncate(event.event_description, length: 15, omission:'...') %> + <%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %> 发表了<%= event.event_type %>:<%= link_to truncate(event.event_description, length: 30, omission:'...'), event.event_url %> -

    <%= time_tag event.event_datetime %>     评论(4)

    +

    <%= time_tag_welcome event.event_datetime %>前     

  • <% end %> @@ -187,13 +149,13 @@
-->
    - <% 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]) %>
  • <%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%>

    - <%= project.description.truncate(50, omission: '... (continued)') %> + <%= project.description.truncate(50, omission: '...') %>