From 733497fef891564d59c77911e3e889f713306aaf Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 14 Apr 2014 17:29:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=B8=AD=E9=83=A8=E5=88=86=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=95=B0=E5=AD=97=E7=9A=84=E8=B6=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 13 +++++++++++++ app/views/contests/_contest_list.html.erb | 7 +++---- app/views/contests/_softapplication_list.html.erb | 2 +- app/views/layouts/base_newcontest.html.erb | 6 +++--- app/views/softapplications/new.html.erb | 2 +- app/views/softapplications/show.html.erb | 8 +++----- config/locales/zh.yml | 1 + 7 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8533c401..9b3a672c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1459,6 +1459,19 @@ module ApplicationHelper end html.html_safe end + + def show_contest_softapplication(contest) + html = '' + if contest.softapplications.where('is_public = 1').count == 0 + html << (content_tag "p", l(:label_no_contest_softapplication), :class => "font_lighter") + else + contest.softapplications.where('is_public = 1').take(12).each do |softapplication| + html << (link_to image_tag(url_to_avatar(project), :class => "avatar", :title => project.name), project_path(project), :class => "avatar") + end + end + html.html_safe + end + def show_contest_fans_picture(obj) html = '' if obj.watcher_users.count == 0 diff --git a/app/views/contests/_contest_list.html.erb b/app/views/contests/_contest_list.html.erb index 5a8bf689..4fb2865c 100644 --- a/app/views/contests/_contest_list.html.erb +++ b/app/views/contests/_contest_list.html.erb @@ -18,10 +18,9 @@ - <%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<%= link_to contest.contesting_projects.count %>) - <%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<%= link_to contest.contesting_softapplications.count %>) - <%= l(:label_contest_response, :count => contest.commit) %>(<%= link_to contest.commit, respond_path(contest) %>) - <%= l(:label_contest_watchers, :count => contest.watcher_users.count) %>(<%= link_to contest.watcher_users.count, respond_path(contest) %>) + <%= 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)) %>) + diff --git a/app/views/contests/_softapplication_list.html.erb b/app/views/contests/_softapplication_list.html.erb index 221dc9dc..570a4067 100644 --- a/app/views/contests/_softapplication_list.html.erb +++ b/app/views/contests/_softapplication_list.html.erb @@ -2,7 +2,7 @@ <%= render_flash_messages %> - + <% if User.current.logged? %> @@ -28,11 +28,9 @@ - @@ -49,7 +47,7 @@
-
+
软件截图:
<% @image_results.take(4).each do |attachment| %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7db6f890..479bfe40 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1842,4 +1842,5 @@ zh: label_softapplication_name_condition: 25个汉字以内(50个字符) label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。 label_contest_description_no: 暂无描述。 + label_no_contest_softapplication: 暂无参赛应用 \ No newline at end of file
<%= l(:label_bidding_project) %> <%= l(:label_contest_softapplication) %>(<%= contesting_softapplication.count%>)
diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 14598db3..2f786008 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -197,15 +197,15 @@
<%= l(:label_contest_application) %> - <% if show_more_contest_project?(@contest) %> - <%= link_to l(:label_more), :controller => 'contests', :action => 'show_project'%> + <% if show_more_contest_softapplication?(@contest) %> + <%= link_to l(:label_more), :controller => 'contests', :action => 'show_softapplication'%> <% end %>
- <%= show_contest_project(@contest) %> + <%= show_contest_softapplication(@contest) %>
diff --git a/app/views/softapplications/new.html.erb b/app/views/softapplications/new.html.erb index b47930d6..a300512c 100644 --- a/app/views/softapplications/new.html.erb +++ b/app/views/softapplications/new.html.erb @@ -50,7 +50,7 @@

- 上传应用软件包或应用截图 + 上传应用软件包和应用截图 <%= render_flash_messages %>

<%= render :partial => 'attachments/form' %> diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 053de150..3728af02 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -10,7 +10,7 @@

<%= notice %>

-
+
系统支持:<%= @softapplication.android_min_version_available %>
应用下载: + 应用下载: <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %> <%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> - - 开发人员:<%= @softapplication.application_developers %>