Merge branch 'competition' into develop

Conflicts:
	db/schema.rb
exceptionHandle
wanglinchun 11 years ago
commit 1ca0113204

@ -98,14 +98,14 @@ module WelcomeHelper
end
def find_all_hot_contest limit=10
# 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
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

@ -25,7 +25,7 @@ class Contest < ActiveRecord::Base
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :deadline
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
# validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
validate :validate_user
after_create :act_as_activity

@ -19,31 +19,32 @@
<table width="100%" border="0">
<tr style="font-size: 18px">
<td colspan="2" valign="top"><strong><%= @softapplication.name %></strong></td>
<td style="font-size: 15px">
<td style="font-size: 15px; padding-left: 0px">
<%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: { confirm: '您确定要删除吗?' } if @softapplication.destroyable_by? User.current %>&nbsp;
<%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
</td>
</tr>
<tr>
<td>所属类别:<%= @softapplication.app_type_name %></td>
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">所属类别:<%= @softapplication.app_type_name %></td>
<% contest = @softapplication.contests.first %>
<td>所属竞赛:<%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%></td>
<td style="width: 240px; word-wrap: break-word; word-break: break-all">所属竞赛:<%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%></td>
</tr>
<tr>
<td>发布人员:<%= @softapplication.user.name %></td>
<td style="padding-left: 40px">发布人员:<%= @softapplication.user.name %></td>
<td>系统支持:<%= @softapplication.android_min_version_available %></td>
</tr>
<tr>
<td>
<td style="padding-left: 40px">
<span>应用下载:</span>
<span><% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %>
<%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %></span>
<span>
<% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %>
</span>
</td>
<td>开发人员:<%= @softapplication.application_developers %></td>
</tr>
<tr>
<td>平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></td>
<td style="padding-left: 40px">平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %></td>
<td>发布时间:<%=format_time @softapplication.created_at %></td>
</tr>

@ -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[6]) %>
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4"; style="float: left; margin-top: 7px">
@ -146,7 +146,8 @@
</div>
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
<%= link_to(contest.name, contest.event_url, :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") %> -->
<%= link_to(contest.name, show_contest_contest_path(contest.id), :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: 12px; margin-bottom: 2px; width: 380px;">

@ -1,10 +1,10 @@
class ChangeCreatedAtOfContestsToCreatedOn < ActiveRecord::Migration
def self.up
def up
rename_column :contests, :created_at, :created_on
rename_column :contests, :updated_at, :updated_on
end
def self.down
def down
rename_column :contests, :created_on, :created_at
rename_column :contests, :updated_on, :updated_at
end

@ -0,0 +1,10 @@
class RemoveBudgetFromContests < ActiveRecord::Migration
def self.up
change_column :contests, :budget, :string, :default => ""
end
def self.down
change_column :contests, :budget, :integer, :default => 0
end
end

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save