diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 10e8a4471..9970ee9c6 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -98,7 +98,14 @@ module WelcomeHelper end def find_all_hot_contest limit=10 - Contest.reorder("created_on DESC").all.take limit + # Contest.reorder("created_on DESC").all.take limit + mix_bid = [] + mix_bid += Contest.reorder("created_on DESC").take(limit).to_a + mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a + mix_bid.sort do |older, newer| + newer.created_on - older.created_on + end + mix_bid.take limit end def find_all_hot_softapplication limit=10 @@ -224,6 +231,10 @@ module WelcomeHelper def sort_contest_by_hot sort_bid_by_hot_rails 2 end +#new added by linchun + def sort_contest_by_time + sort_bid_by_time 2 + end #取得所有活动 def find_all_activities limit=6 @@ -278,6 +289,10 @@ module WelcomeHelper Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit) end + def sort_bid_by_time reward_type, limit = 10 + Bid.visible.where('reward_type = ?', reward_type).reorder('bids.created_on desc').limit(limit) + end + def find_all_event_type event case event.event_type when 'news' diff --git a/app/views/contests/_contest_list.html.erb b/app/views/contests/_contest_list.html.erb index 4fb2865c8..fb3ddd115 100644 --- a/app/views/contests/_contest_list.html.erb +++ b/app/views/contests/_contest_list.html.erb @@ -6,7 +6,7 @@ - + - @@ -29,13 +29,14 @@ +
+
<%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>:  <%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path') %><%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>:  <%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %>
@@ -18,8 +18,8 @@
<%= 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)) %>) + <%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<%= link_to(contest.contesting_projects.count, show_project_contest_path(contest), :target => "_blank") %>) + <%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest), :target => "_blank") %>)
-
- - - - -
<%= contest.description%>
-
+ + + +
+ + diff --git a/app/views/contests/index.html.erb b/app/views/contests/index.html.erb index 3a7bde1e5..670ba27cf 100644 --- a/app/views/contests/index.html.erb +++ b/app/views/contests/index.html.erb @@ -7,7 +7,7 @@ <% if User.current.logged? %> <% unless User.current.user_extensions.identity == 1 %> - <%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add') %> + <%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add', :target => "_blank") %> <% end %> <% end %> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 190209ae4..9813905ca 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -10,6 +10,7 @@ <%= favicon %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index f3d7f092e..8c0addb8d 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -138,7 +138,7 @@ <%= 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[5]) %> + <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[6]) %>
  • @@ -146,7 +146,7 @@
    - <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> + <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
    @@ -154,8 +154,8 @@

    - <%= 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)) %>) + + 发布时间:<%=format_time contest.created_on %>