From 3d02cb7ce0147357d30b204052bbf1d5a2f5e2cd Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Sat, 19 Apr 2014 10:56:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/softapplication.rb | 3 +-- app/views/layouts/base_newcontest.html.erb | 2 +- app/views/softapplications/show.html.erb | 5 +---- app/views/welcome/contest.html.erb | 5 +++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index 603279fbd..71caf059c 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -1,8 +1,7 @@ class Softapplication < ActiveRecord::Base attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers acts_as_attachable - seems_rateable :allow_update => true, :dimensions => :quality - seems_rateable_rater + has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :contesting_softapplications, :dependent => :destroy belongs_to :user diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index c0e23bf21..9813905ca 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -10,7 +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' %> - <%= seems_rateable_stylesheet %> + <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index fcd746776..5ddd752d3 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -34,10 +34,7 @@ 开发人员:<%= @softapplication.application_developers %> - - rate: <%=rating_for @softapplication, :dimension => :qulity %> - - + diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index f3d7f092e..38afd6091 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -154,8 +154,9 @@
- <%= 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 %>
From 43064c4bc24726776cd645a519fc9c2b0c0ec58b Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Sat, 19 Apr 2014 13:10:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E9=A6=96=E9=A1=B5=E4=B8=AD=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E7=AB=9E=E8=B5=9B=EF=BC=9A=E6=97=A2=E6=9C=89=E6=97=A7?= =?UTF-8?q?=E7=9A=84=E7=AB=9E=E8=B5=9B=E5=8F=88=E6=9C=89=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/welcome_helper.rb | 17 ++++++++++++++++- app/views/welcome/contest.html.erb | 7 +++---- 2 files changed, 19 insertions(+), 5 deletions(-) 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/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 38afd6091..27ab04e1a 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[8]) %>
  • @@ -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,7 @@

    - + 发布时间:<%=format_time contest.created_on %>
    From edb5dac785ac944c082fb5d3fe845e61f26785ef Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Sat, 19 Apr 2014 14:19:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/_contest_list.html.erb | 21 +++++++++++---------- app/views/contests/index.html.erb | 2 +- app/views/welcome/contest.html.erb | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) 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/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 27ab04e1a..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[8]) %> + <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[6]) %>