From 3a5b5bc0cec58fa75ea9c38fd496963947e85bd8 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 16 Apr 2014 17:32:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=A8=A1=E5=9D=97=E7=9A=84=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/contests_helper.rb | 1 + app/helpers/welcome_helper.rb | 6 +- app/views/welcome/contest.html.erb | 99 +++++++++++++++++------------- 3 files changed, 64 insertions(+), 42 deletions(-) diff --git a/app/helpers/contests_helper.rb b/app/helpers/contests_helper.rb index 93af48b4c..cb4d6a0f7 100644 --- a/app/helpers/contests_helper.rb +++ b/app/helpers/contests_helper.rb @@ -167,5 +167,6 @@ module ContestsHelper end tmp end + end \ No newline at end of file diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index f56281d6b..10e8a4471 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -98,9 +98,13 @@ module WelcomeHelper end def find_all_hot_contest limit=10 - Contest.all.take limit + Contest.reorder("created_on DESC").all.take limit end + def find_all_hot_softapplication limit=10 + Softapplication.reorder("created_at DESC").all.take limit + end + def cal_memos_count event return nil if event.parent_id event.replies_count diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 60aafd949..935f28ea5 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -93,10 +93,11 @@
+
<%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_contest) %> , <%= l(:label_welcome_trustie_contest_description) %>
@@ -125,38 +126,46 @@ <% end %>
-
- -
-
-

最新热门竞赛

- <%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %> +
+

最新热门竞赛

+ <%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %>
-
    - <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[10]) %> -
  • -

    - <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", - :style => "margin-left: 28px;", :target => "_blank") %> -

    -

    - <%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %> -

    +
    + <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %> + +
  • +
    + <%= image_tag('/images/039.gif')%> +
    + +
    + <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> +
    + +
    + ><%=contest.description.truncate(50, omission: '...')%> +

    + +
    + <%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<%= link_to(contest.contesting_projects.count, show_project_contest_path(contest)) %>) + <%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest)) %>) +
    +
  • - <% end %> -
+ <% end; reset_cycle %> + +
+

问题和反馈动态 @@ -167,7 +176,7 @@
    <% find_new_forum_topics(10).each do |topic|%> -
  • +
  •       <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> @@ -184,32 +193,40 @@

-
-

最新参赛应用

+
+

最新参赛应用

+ <%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %>
-
    - <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[10]) %> -
  • -

    - <%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", - :style => "margin-left: 28px;", :target => "_blank") %> -

    -

    - <%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %> -

    +
    + <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %> + +
  • +
    + <%= image_tag('/images/007.gif')%> +
    + +
    + <%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %> +
    + +
    + ><%=softapplication.description.truncate(50, omission: '...')%> +

    + +
    + 发布时间:<%=format_time softapplication.created_at %> +
    +
  • - <% end %> -
+ <% end; reset_cycle %> + +
- -
-
+
-






-