erge branch 'competition' into develop

Conflicts:
	app/views/layouts/base_newcontest.html.erb
This commit is contained in:
xianbo 2014-04-21 08:46:08 +08:00
commit bb4d141b0e
5 changed files with 33 additions and 16 deletions

View File

@ -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'

View File

@ -6,7 +6,7 @@
<td>
<table width="100%" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>: &nbsp;<%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path') %></strong></td>
<td colspan="2" valign="top"><strong><%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>: &nbsp;<%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %></strong></td>
</tr>
<tr>
<td width="500">
@ -18,8 +18,8 @@
</tr>
<tr>
<td><span class="font_lighter"><%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_projects.count, show_project_contest_path(contest)) %></span></strong>)</span>
<span class="font_lighter"><%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest)) %></span></strong>)</span>
<td><span class="font_lighter"><%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_projects.count, show_project_contest_path(contest), :target => "_blank") %></span></strong>)</span>
<span class="font_lighter"><%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest), :target => "_blank") %></span></strong>)</span>
</td>
</tr>
@ -29,13 +29,14 @@
</tr>
<tr>
<td>
<div class="bid-description" style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
<table width="100%">
<tr>
<td> <%= contest.description%> </td>
</tr>
</table>
</div></td>
<div class="bid-description" style="border-left: 1px solid #d9d8d8; border-bottom: 1px solid #d9d8d8; padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
<table width="100%">
<tr>
<!-- <td> <%= contest.description%> </td> -->
</tr>
</table>
</div>
</td>
</tr>
</table></td>
</tr>

View File

@ -7,7 +7,7 @@
<td rowspan="2">
<% 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 %>
</td>

View File

@ -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 %>

View File

@ -138,7 +138,7 @@
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %></span>
<div class="d-p-projectlist-box">
<div class="d-p-projectlist">
<% 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]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px">
@ -146,7 +146,7 @@
</div>
<div style="float: left; margin-left: -8px; margin-top: 5px; width: 380px;">
<%= 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") %>
</div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: -8px; width: 380px;">
@ -154,8 +154,8 @@
</div><br />
<div style="padding-left: 36px; clear: left;">
<span class="font_lighter"><%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_projects.count, show_project_contest_path(contest)) %></span></strong>)</span>
<span class="font_lighter"><%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest)) %></span></strong>)</span>
<span class="font_lighter">发布时间:<%=format_time contest.created_on %></span>
</div>
</li>