From 47b3c55b40267853fc2df8d37e93feac48d3590a Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 15:46:22 +0800 Subject: [PATCH 01/35] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=B8=AD=E7=9A=84app=E4=B8=BA=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/contest.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index e32d375d0..29b825f40 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -153,9 +153,9 @@ <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> - (<%= link_to("含#{contest.projects.where('is_public=1').count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %>) + (<%= link_to("含#{contest.projects.where('is_public=1').count}个作品", show_attendingcontest_contest_path(contest), :target => "_blank") %>) <% else %> - (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %>) + (<%= link_to("含#{contest.contesting_softapplications.count}个作品", show_attendingcontest_contest_path(contest), :target => "_blank") %>) <% end %> From dcc4167e06a58803c8686bc1f23a152e1a68a7a5 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 18:31:04 +0800 Subject: [PATCH 02/35] =?UTF-8?q?=E5=B0=86=E7=AB=9E=E8=B5=9B=E4=B8=AD?= =?UTF-8?q?=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E7=9A=84?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=96=B9=E5=BC=8F=E6=94=B9=E4=B8=BA=E6=8C=89?= =?UTF-8?q?=E6=89=93=E5=88=86=E9=AB=98=E4=BD=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 7 ++++++- app/views/contests/show_attendingcontest.html.erb | 14 +++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 7741333a8..12935d85f 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -335,7 +335,12 @@ class ContestsController < ApplicationController end ##取出参赛应用 @softapplication = Softapplication.all - @contesting_softapplication = @contest.contesting_softapplications.reverse + @contesting_softapplication = @contest.contesting_softapplications. + joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id"). + joins("LEFT JOIN seems_rateable_cached_ratings ON seems_rateable_cached_ratings.cacheable_id=softapplications.id"). + where("seems_rateable_cached_ratings.cacheable_type='Softapplication'"). + where("seems_rateable_cached_ratings.dimension = 'quality'"). + order("seems_rateable_cached_ratings.avg").reverse_order @contesting_softapplication = paginateHelper @contesting_softapplication, 10 diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 8a00f12ae..062776a08 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -61,13 +61,13 @@ -
+
温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!
<% if User.current.logged? %>
-
+
参赛步骤:
@@ -90,7 +90,7 @@ <%= l(:label_softapplication_name) %> * : <%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %> - +


@@ -98,7 +98,7 @@ <%= l(:label_softapplication_version_available) %> * : <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %> - +


@@ -107,7 +107,7 @@ * : <%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> - +


@@ -115,7 +115,7 @@ <%= l(:label_softapplication_description) %> * : <%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %> - +


@@ -123,7 +123,7 @@ <%= l(:label_softapplication_developers) %> * : <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %> - +


From 121b6389d514729f70d5650c2b7c0ebc0bc2b970 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 19:39:58 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E6=9C=80=E7=BB=88=E5=BE=97?= =?UTF-8?q?=E5=88=86=E7=9A=84=E5=88=86=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 4bd6871a0..ff2516ccf 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -82,6 +82,7 @@
最终得分
+
<%= @softapplication.average(:quality).avg%> 分
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
From 73a82662af73cbcec5b400a3ea8f90a4943de99c Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 19:52:22 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=9C=80=E7=BB=88?= =?UTF-8?q?=E5=BE=97=E5=88=86=E6=95=B0=E5=80=BC=E4=BF=9D=E7=95=99=E4=B8=A4?= =?UTF-8?q?=E4=BD=8D=E5=B0=8F=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index ff2516ccf..80060e5d0 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -82,7 +82,7 @@
最终得分
-
<%= @softapplication.average(:quality).avg%> 分
+
<%= @softapplication.average(:quality).avg.round(2)%> 分
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
From 62c81ad8841545b3693393680783398a5c2c758d Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 20:09:13 +0800 Subject: [PATCH 05/35] =?UTF-8?q?=E7=BB=99=E7=AB=9E=E8=B5=9B=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9C=80=E7=BB=88=E5=BE=97=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 062776a08..b6ef0ed40 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -228,11 +228,10 @@
- - 发布时间: - <%= format_time c_softapplication.created_at %> + 发布时间:<%= format_time c_softapplication.created_at %> + 最终得分:<%= c_softapplication.softapplication.average(:quality).avg.round(2)%>分 - +
<% end %> From 81c3659a892c6501e5cfca1bb17249f27306c754 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 20:21:54 +0800 Subject: [PATCH 06/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E7=9A=84=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 10 +++++----- config/locales/zh.yml | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index b6ef0ed40..40f9420bd 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -88,14 +88,14 @@
- <%= l(:label_softapplication_name) %> + <%= l(:label_work_name) %> * : <%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %>


- <%= l(:label_softapplication_version_available) %> + <%= l(:label_running_platform) %> * : <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %>
@@ -103,7 +103,7 @@
- <%= l(:label_softapplication_type) %> + <%= l(:label_work_type) %> * : <%= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %> @@ -112,7 +112,7 @@
- <%= l(:label_softapplication_description) %> + <%= l(:label_work_description) %> * : <%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %>
@@ -129,7 +129,7 @@
- 上传应用软件包和应用截图 + 上传作品软件包和作品截图 <%= render_flash_messages %>

diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 774d1fbfb..c3c27ec09 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1850,13 +1850,17 @@ zh: label_release_softapplication: 发布应用 label_upload_softapplication_packets: 上传应用软件包 label_upload_softapplication_photo: 上传产品截图 - label_upload_softapplication_packets_mustpacketed: 应用软件作品必须打包后以压缩包的形式上传,便于上传和下载 ; - label_upload_softapplication_photo_condition: 应用软件截图需上传4张;格式为gif/jpg/png, 尺寸480*800, 每张小于2M - label_updated_caution: 注意:若修改应用,则之前上传的软件包和截图都将被删除,请重新上传! + label_upload_softapplication_packets_mustpacketed: 作品相关代码及相关说明文件必须打包后以压缩包的形式上传,便于上传和下载 ; + label_upload_softapplication_photo_condition: 作品截图需上传0~4张;格式为gif/jpg/png, 每张小于5M + label_updated_caution: 注意:若参赛作品,则之前上传的软件包和截图都将被删除,请重新上传! label_softapplication_name: 应用名称 + label_work_name: 作品名称 label_softapplication_description: 应用简介 + label_work_description: 作品简介 label_softapplication_type: 应用分类 + label_work_type: 作品分类 label_softapplication_version_available: 适配版本 + label_running_platform: 运行平台 label_softapplication_developer: 上传人员 label_softapplication_developers: 开发人员 label_softapplication_name_condition: 25个汉字以内(50个字符) From da48b5ba367bda2aa67995a7ea88e2b9647fec57 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 20:56:03 +0800 Subject: [PATCH 07/35] swd --- app/views/softapplications/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 80060e5d0..dcbc45f14 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -82,7 +82,7 @@

最终得分
-
<%= @softapplication.average(:quality).avg.round(2)%> 分
+
<%=@softapplication.average(:quality).avg.round(2)%>
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
From cf18b94326898e8d180d171091c40bd96a198292 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 13 May 2014 08:38:48 +0800 Subject: [PATCH 08/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E4=B8=AD=E7=9A=84=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8C=89=E5=BE=97=E5=88=86=E6=8E=92=E5=BA=8F?= =?UTF-8?q?=EF=BC=9B=20=E5=A2=9E=E5=8A=A0=E5=8F=82=E8=B5=9B=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E9=A1=B5=E9=9D=A2=E5=92=8C=E7=AB=9E=E8=B5=9B=E4=B8=AD?= =?UTF-8?q?=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E5=BE=97=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 10 +++++----- app/views/contests/show_attendingcontest.html.erb | 2 +- app/views/softapplications/show.html.erb | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 12935d85f..719195cb3 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -336,11 +336,11 @@ class ContestsController < ApplicationController ##取出参赛应用 @softapplication = Softapplication.all @contesting_softapplication = @contest.contesting_softapplications. - joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id"). - joins("LEFT JOIN seems_rateable_cached_ratings ON seems_rateable_cached_ratings.cacheable_id=softapplications.id"). - where("seems_rateable_cached_ratings.cacheable_type='Softapplication'"). - where("seems_rateable_cached_ratings.dimension = 'quality'"). - order("seems_rateable_cached_ratings.avg").reverse_order + joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id"). + joins("LEFT JOIN ( + SELECT * FROM seems_rateable_cached_ratings WHERE cacheable_type='Softapplication' AND DIMENSION = 'quality') AS cached + ON cached.cacheable_id=softapplications.id"). + order("cached.avg").reverse_order @contesting_softapplication = paginateHelper @contesting_softapplication, 10 diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 40f9420bd..834019c8a 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -229,7 +229,7 @@
发布时间:<%= format_time c_softapplication.created_at %> - 最终得分:<%= c_softapplication.softapplication.average(:quality).avg.round(2)%>分 + 最终得分:<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分
diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index dcbc45f14..1dfbf0154 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -82,7 +82,7 @@
最终得分
-
<%=@softapplication.average(:quality).avg.round(2)%>
+
<%=@softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
From fc2f35f2477babe01d81242aa9099f6cfa8697e6 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 13 May 2014 11:44:29 +0800 Subject: [PATCH 09/35] =?UTF-8?q?=E5=B0=86=E5=85=B3=E8=81=94=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=95=B4=E5=90=88=E5=88=B0=E6=96=B0=E5=BB=BA=E5=8F=82?= =?UTF-8?q?=E8=B5=9B=E4=BD=9C=E5=93=81=E4=B8=AD=EF=BC=8C=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=85=B3=E8=81=94=E5=88=B0=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../softapplications_controller.rb | 29 +++++++++++++- app/models/contesting_softapplication.rb | 5 +++ .../contests/show_attendingcontest.html.erb | 40 ++++--------------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 9ede52489..6860bfa6a 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -100,14 +100,34 @@ class SoftapplicationsController < ApplicationController # POST /softapplications # POST /softapplications.json + # def create + # @softapplication = Softapplication.new(params[:softapplication]) + # @softapplication.user = User.current + # @softapplication.save_attachments(params[:attachments]) + # respond_to do |format| + # if @softapplication.save + # format.js + # format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } + # # format.json { render json: @softapplication, status: :created, location: @softapplication } + # else + # format.js { render status: 406 } + # format.html { render action: "new" } + # # format.json { render json: @softapplication.errors, status: :unprocessable_entity } + # end + # end + # end + + +#new changed created function def create @softapplication = Softapplication.new(params[:softapplication]) @softapplication.user = User.current @softapplication.save_attachments(params[:attachments]) respond_to do |format| if @softapplication.save + ContestingSoftapplication.create(:contest_id => params[:contest_id], :softapplication_id => @softapplication.id) format.js - format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } + format.html { redirect_to show_attendingcontest_contest_path(:id => params[:contest_id]) } # format.json { render json: @softapplication, status: :created, location: @softapplication } else format.js { render status: 406 } @@ -115,8 +135,13 @@ class SoftapplicationsController < ApplicationController # format.json { render json: @softapplication.errors, status: :unprocessable_entity } end end + #关联新建的参赛作品 + + # @contesting_softapplication = paginateHelper @contest.contesting_softapplications + + + end - # PUT /softapplications/1 # PUT /softapplications/1.json def update diff --git a/app/models/contesting_softapplication.rb b/app/models/contesting_softapplication.rb index 93aea2658..37ba198b8 100644 --- a/app/models/contesting_softapplication.rb +++ b/app/models/contesting_softapplication.rb @@ -11,5 +11,10 @@ class ContestingSoftapplication < ActiveRecord::Base self.create(:user_id => User.current.id, :contest_id => contest_id, :softapplication_id => softapplication_id, :description => description) end + + def self.create_work_contesting(contest_id, softapplication_id) + self.create(:user_id => User.current.id, :contest_id => contest_id, + :softapplication_id => softapplication_id) + end end diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 834019c8a..d1c81316a 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -76,17 +76,14 @@ <%= link_to '新建参赛作品', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %> (先点击“新建参赛作品”,然后刷新页面,再继续步骤2。)
-
- 步骤2: - <%= link_to '关联参赛作品', "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %> -
+ - + - - <% end %> From bbd293272da641a5fe074ed4503a37f4245d3219 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 13 May 2014 16:49:23 +0800 Subject: [PATCH 10/35] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=82=E8=B5=9B?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=89=80=E5=B1=9E=E9=A1=B9=E7=9B=AE=E7=9A=84?= =?UTF-8?q?=E7=BD=91=E5=9D=80=EF=BC=9B=20=E5=8F=82=E8=B5=9B=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BD=91=E5=9D=80=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/softapplication.rb | 2 +- .../contests/show_attendingcontest.html.erb | 8 ++ app/views/softapplications/show.html.erb | 3 + config/locales/zh.yml | 1 + ...deposit_project_url_to_softapplications.rb | 5 ++ db/schema.rb | 76 ++++++++++++++----- 6 files changed, 77 insertions(+), 18 deletions(-) create mode 100644 db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index 6782b2436..3911424e9 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -1,5 +1,5 @@ class Softapplication < ActiveRecord::Base - attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers + attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers, :deposit_project_url acts_as_attachable seems_rateable :allow_update => true, :dimensions => :quality diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index d1c81316a..06ef0533f 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -124,6 +124,14 @@

+ + <%= l(:label_work_deposit_project_url) %>: + <%= f.text_field :deposit_project_url, :required => true, :size => 60, :style => "width:378px;" %> + +
+
+
+
上传作品软件包和作品截图 diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 1dfbf0154..3f7e689a8 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -47,6 +47,9 @@ 平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> 发布时间:<%=format_time @softapplication.created_at %> + + 托管项目网址:<%=@softapplication.deposit_project_url%>> + diff --git a/config/locales/zh.yml b/config/locales/zh.yml index c3c27ec09..18f05763f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1863,6 +1863,7 @@ zh: label_running_platform: 运行平台 label_softapplication_developer: 上传人员 label_softapplication_developers: 开发人员 + label_work_deposit_project_url: 托管项目网址 label_softapplication_name_condition: 25个汉字以内(50个字符) label_user_login_softapplication_board: 您还没有登录,请登录后参与应用评价。 label_contest_description_no: 暂无描述。 diff --git a/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb b/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb new file mode 100644 index 000000000..dd01cdab5 --- /dev/null +++ b/db/migrate/20140513073801_add_deposit_project_url_to_softapplications.rb @@ -0,0 +1,5 @@ +class AddDepositProjectUrlToSoftapplications < ActiveRecord::Migration + def change + add_column :softapplications, :deposit_project_url, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index fe23a1caa..c96659ab9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140428013546) do +ActiveRecord::Schema.define(:version => 20140513073801) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,6 +23,15 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -518,6 +527,14 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "news", ["created_on"], :name => "index_news_on_created_on" add_index "news", ["project_id"], :name => "news_project_id" + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "open_id_authentication_associations", :force => true do |t| t.integer "issued" t.integer "lifetime" @@ -533,6 +550,19 @@ ActiveRecord::Schema.define(:version => 20140428013546) do t.string "salt", :null => false end + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "praise_tread_caches", :force => true do |t| t.integer "object_id", :null => false t.string "object_type" @@ -612,6 +642,24 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + create_table "relative_memos", :force => true do |t| + t.integer "osp_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + t.string "url" + end + create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -698,6 +746,7 @@ ActiveRecord::Schema.define(:version => 20140428013546) do t.integer "softapplication_id" t.integer "is_public" t.string "application_developers" + t.string "deposit_project_url" end create_table "students_for_courses", :force => true do |t| @@ -755,11 +804,6 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "time_entries", ["project_id"], :name => "time_entries_project_id" add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id" - create_table "tmp", :force => true do |t| - t.string "name" - t.string "part_number" - end - create_table "tokens", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.string "action", :limit => 30, :default => "", :null => false @@ -810,6 +854,13 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "user_preferences", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.text "others" @@ -820,16 +871,13 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false + t.integer "user_id" t.integer "collaboration" t.integer "influence" t.integer "skill" - t.integer "active" + t.integer "activity" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" end create_table "user_statuses", :force => true do |t| @@ -966,10 +1014,4 @@ ActiveRecord::Schema.define(:version => 20140428013546) do add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status" add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id" - create_table "yans", :force => true do |t| - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - end From 69c1ddad5c4f410f0784e95431e938fd2018d8be Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 13 May 2014 17:18:06 +0800 Subject: [PATCH 11/35] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=8F=82=E8=B5=9B?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=89=98=E7=AE=A1?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BD=91=E5=9D=80=E5=B9=B6=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E7=9B=B8=E5=85=B3=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 06ef0533f..5aff8d1e0 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -61,21 +61,22 @@ -
- 温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛! +
+ 温馨提示:如果您准备参加竞赛,请点击下面的"新建参赛作品"!
<% if User.current.logged? %> -
-
- 参赛步骤: +
+
+ 参加竞赛: + <%= link_to '新建参赛作品', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %>
-
+
@@ -131,6 +132,7 @@


+
From a8b58016fae84347dd19c74c344ceb911b84ffa0 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 09:09:49 +0800 Subject: [PATCH 12/35] df --- app/views/softapplications/show.html.erb | 3 +-- db/schema.rb | 7 +++++-- lib/redmine.rb | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 3f7e689a8..09eb18ae7 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -10,7 +10,6 @@

<%= notice %>

-
@@ -48,7 +47,7 @@ 发布时间:<%=format_time @softapplication.created_at %> - 托管项目网址:<%=@softapplication.deposit_project_url%>> + 托管项目网址:<%=@softapplication.deposit_project_url%> diff --git a/db/schema.rb b/db/schema.rb index c96659ab9..fb241ac03 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -871,13 +871,16 @@ ActiveRecord::Schema.define(:version => 20140513073801) do add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" create_table "user_scores", :force => true do |t| - t.integer "user_id" + t.integer "user_id", :null => false t.integer "collaboration" t.integer "influence" t.integer "skill" - t.integer "activity" + t.integer "active" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "level" + t.integer "file" + t.integer "issue" end create_table "user_statuses", :force => true do |t| diff --git a/lib/redmine.rb b/lib/redmine.rb index d22feb9fc..3d3565430 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -279,8 +279,8 @@ end ###new add by linchun Redmine::MenuManager.map :contest_menu do |menu| menu.push :respond, :show_contest_contest_path, :caption => :label_user_response - #menu.push :project, :show_project_contest_path, :caption => :label_contest_project - #menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application + menu.push :project, :show_project_contest_path, :caption => :label_contest_project + menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest # menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest # menu.push :result, { :controller => 'bids', :action => 'show_results' }, From 65340f604d5c2ced1bf670b5f8175898ff58049b Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 09:23:04 +0800 Subject: [PATCH 13/35] sdf --- config/routes.rb | 1 + lib/redmine.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index a64acb2c6..62d773077 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -127,6 +127,7 @@ RedmineApp::Application.routes.draw do match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' match 'account/activate', :to => 'account#activate', :via => :get + match 'account/valid_ajax', :to => 'account#valid_ajax', :via => :get match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put] match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] diff --git a/lib/redmine.rb b/lib/redmine.rb index 3d3565430..d22feb9fc 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -279,8 +279,8 @@ end ###new add by linchun Redmine::MenuManager.map :contest_menu do |menu| menu.push :respond, :show_contest_contest_path, :caption => :label_user_response - menu.push :project, :show_project_contest_path, :caption => :label_contest_project - menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application + #menu.push :project, :show_project_contest_path, :caption => :label_contest_project + #menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest # menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest # menu.push :result, { :controller => 'bids', :action => 'show_results' }, From 4ea861194260b4e9d1a5159ae459ccb2ae5a069e Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 16:19:12 +0800 Subject: [PATCH 14/35] =?UTF-8?q?=E6=95=99=E5=B8=88=E8=AF=84=E5=A5=96?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 40 ++++++- app/helpers/contests_helper.rb | 4 + app/models/contesting_softapplication.rb | 8 ++ ...eward.js.erb => set_reward_project.js.erb} | 7 +- .../set_reward_softapplication.js.erb | 30 +++++ .../contests/show_attendingcontest.html.erb | 111 ++++++++++++++++++ config/routes.rb | 22 ++-- 7 files changed, 207 insertions(+), 15 deletions(-) rename app/views/contests/{set_reward.js.erb => set_reward_project.js.erb} (87%) create mode 100644 app/views/contests/set_reward_softapplication.js.erb diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 719195cb3..debda938f 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -5,7 +5,7 @@ class ContestsController < ApplicationController menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication menu_item :attendingcontest, :only => :show_attendingcontest - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -355,6 +355,44 @@ class ContestsController < ApplicationController end ###end + + def set_reward_project + @c_p = nil + @contesting_project_id = nil + + if params[:set_reward_project][:reward]&&((User.current.id==@contest.author_id)||User.current.admin) + # @bid_id = params[:id] + @contesting_project_id = params[:set_reward_project][:c_id] + @c_p = ContestingProject.find_by_id(@contesting_project_id) + + # 把字段存进表中 + @c_p.update_reward(params[:set_reward_project][:reward].to_s) + end + + respond_to do |format| + format.js + end + end + + def set_reward_softapplication + @c_sa = nil + @contesting_softapplication_id = nil + + if params[:set_reward_softapplication][:reward]&&((User.current.id==@contest.author_id)||User.current.admin) + # @bid_id = params[:id] + @contesting_softapplication_id = params[:set_reward_softapplication][:c_id] + @c_sa = ContestingSoftapplication.find_by_id(@contesting_softapplication_id) + + # 把字段存进表中 + @c_sa.update_reward(params[:set_reward_softapplication][:reward].to_s) + end + + respond_to do |format| + format.js + end + end + + ###添加已创建的参赛项目 def add project = Project.find(params[:contest]) diff --git a/app/helpers/contests_helper.rb b/app/helpers/contests_helper.rb index 36f2351cb..fff2f785a 100644 --- a/app/helpers/contests_helper.rb +++ b/app/helpers/contests_helper.rb @@ -91,6 +91,10 @@ module ContestsHelper def get_prize(c_project) c_project.get_reward end + + def get_prize(c_softapplication) + c_softapplication.get_reward + end def count_contest_project contests = Contest.find(:id) diff --git a/app/models/contesting_softapplication.rb b/app/models/contesting_softapplication.rb index 37ba198b8..f880818d9 100644 --- a/app/models/contesting_softapplication.rb +++ b/app/models/contesting_softapplication.rb @@ -16,5 +16,13 @@ class ContestingSoftapplication < ActiveRecord::Base self.create(:user_id => User.current.id, :contest_id => contest_id, :softapplication_id => softapplication_id) end + + def update_reward(which) + self.update_attribute(:reward,which) + end + + def get_reward + self.reward + end end diff --git a/app/views/contests/set_reward.js.erb b/app/views/contests/set_reward_project.js.erb similarity index 87% rename from app/views/contests/set_reward.js.erb rename to app/views/contests/set_reward_project.js.erb index d6d8c4f9f..c0de3e2ef 100644 --- a/app/views/contests/set_reward.js.erb +++ b/app/views/contests/set_reward_project.js.erb @@ -1,15 +1,14 @@ $('#reward_result_<%= @contesting_project_id %>').html('<%= j( -if get_prize(@b_p).nil? or get_prize(@b_p) == "" +if get_prize(@c_p).nil? or get_prize(@c_p) == "" if @contest.deadline < Date.today puts '未评奖' end else - case get_prize(@b_p) + case get_prize(@c_p) when '-1' image_tag("/images/bid/special_reward.png") - when '1' when '0' image_tag("/images/bid/first_reward.png") when '1' @@ -22,7 +21,7 @@ else image_tag("/images/bid/fifth_reward.png") when '5' image_tag("/images/bid/qualified.png") - end + end end ) diff --git a/app/views/contests/set_reward_softapplication.js.erb b/app/views/contests/set_reward_softapplication.js.erb new file mode 100644 index 000000000..a8cf0d486 --- /dev/null +++ b/app/views/contests/set_reward_softapplication.js.erb @@ -0,0 +1,30 @@ +$('#reward_result_<%= @contesting_softapplication_id %>').html('<%= j( + +if get_prize(@c_sa).nil? or get_prize(@c_sa) == "" + if @contest.deadline < Date.today + puts '未评奖' + end +else + + case get_prize(@c_sa) + when '-1' + image_tag("/images/bid/special_reward.png") + when '0' + image_tag("/images/bid/first_reward.png") + when '1' + image_tag("/images/bid/second_reward.png") + when '2' + image_tag("/images/bid/third_reward.png") + when '3' + image_tag("/images/bid/forth_reward.png") + when '4' + image_tag("/images/bid/fifth_reward.png") + when '5' + image_tag("/images/bid/qualified.png") + end + +end +) +%>') + +$('#<%= @contesting_softapplication_id %>').hide() diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 5aff8d1e0..c556a6e59 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -193,6 +193,61 @@
+
+ + + + + <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> + <% if @contest.deadline < Date.today %> + <%= l(:label_noawards)%> + <% end %> + <% else %> + <% case get_prize(c_project) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png")%> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png")%> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png")%> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png")%> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png")%> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png")%> + <% end %> + <% end %> + + + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + + <%= toggle_link '评价', c_project.id.to_s %> + + + + <% end %> + + + +
<% end %>
@@ -219,6 +274,62 @@
+ +
+ + + + + <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> + <% if @contest.deadline < Date.today %> + <%= l(:label_noawards)%> + <% end %> + <% else %> + <% case get_prize(c_softapplication) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png")%> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png")%> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png")%> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png")%> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png")%> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png")%> + <% end %> + <% end %> + + + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + + <%= toggle_link '评价', c_softapplication.id.to_s %> + + + + <% end %> + + + +
<% end %>
diff --git a/config/routes.rb b/config/routes.rb index 62d773077..a858b204a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,16 +67,18 @@ RedmineApp::Application.routes.draw do end member do match 'add_softapplication' - match 'update_contest' , via: [:put] - match 'show_contest' , via: :get - match 'show_project' , via: :get - match 'show_softapplication' , via: :get - match 'show_attendingcontest' , via: :get - match 'show_participator' , via: :get - match 'add' , via: [:get, :post] - match 'add_softapplication' , via: [:get, :post] - match 'create' , via: :post - match 'settings' , via: [:get, :post] + match 'update_contest' , via: [:put] + match 'show_contest' , via: :get + match 'show_project' , via: :get + match 'show_softapplication' , via: :get + match 'show_attendingcontest' , via: :get + match 'show_participator' , via: :get + match 'set_reward_project' , via: [:get, :post] + match 'set_reward_softapplication' , via: [:get, :post] + match 'add' , via: [:get, :post] + match 'add_softapplication' , via: [:get, :post] + match 'create' , via: :post + match 'settings' , via: [:get, :post] end end From d019a4d9ce5bdf40c63fd5d776ba1195b2faae7b Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 16:29:46 +0800 Subject: [PATCH 15/35] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BA=86=EF=BC=9A=E8=AF=84=E5=A5=96=EF=BC=8C=E6=9A=82=E6=9C=AA?= =?UTF-8?q?=E8=AF=84=E5=A5=96=EF=BC=8C=E6=9C=AA=E8=AF=84=E5=A5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 4 ++++ config/locales/zh.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index c556a6e59..04ba3a61b 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -201,6 +201,8 @@ <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> <% if @contest.deadline < Date.today %> <%= l(:label_noawards)%> + <% else%> + <%= l(:label_noawards_current)%> <% end %> <% else %> <% case get_prize(c_project) %> @@ -283,6 +285,8 @@ <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> <% if @contest.deadline < Date.today %> <%= l(:label_noawards)%> + <% else%> + <%= l(:label_noawards_current)%> <% end %> <% else %> <% case get_prize(c_softapplication) %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 18f05763f..fb6e10f5a 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1893,6 +1893,7 @@ zh: label_relation_files: 关联已有资源 label_contest_settings: 配置竞赛 label_contest_delete: 删除竞赛 + label_noawards_current: 暂未评奖 # ajax异步验证 modal_valid_passing: 可以使用 From 75853bca014454f4a747a9b3154a1a35e2bd2f79 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 17:15:19 +0800 Subject: [PATCH 16/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E4=B8=AD=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E5=90=84=E9=A1=B9?= =?UTF-8?q?=E6=8C=87=E6=A0=87=E7=9A=84=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 04ba3a61b..f3f788c64 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -229,7 +229,7 @@ <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> - <%= toggle_link '评价', c_project.id.to_s %> + <%= toggle_link '评奖', c_project.id.to_s %>
+
- 简介: + 简介: <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %>
-
- 发布时间:<%= format_time c_softapplication.created_at %> - 最终得分:<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分 - - + +
+ 发布时间:<%= format_time c_softapplication.created_at %> + 发布人员:<%= c_softapplication.softapplication.user.name %>
+ -
- - +
+ 最终得分:<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分 + + - + <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> <% if @contest.deadline < Date.today %> - <%= l(:label_noawards)%> + <%= l(:label_noawards)%> <% else%> - <%= l(:label_noawards_current)%> + <%= l(:label_noawards_current)%> <% end %> <% else %> <% case get_prize(c_softapplication) %> @@ -313,7 +315,7 @@ <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> - <%= toggle_link '评价', c_softapplication.id.to_s %> + <%= toggle_link '评奖', c_softapplication.id.to_s %> <% end %> - - - +
<% end %> From fd87245251e49b8c7298a960fb4b61a0f4f2fbd1 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 17:27:20 +0800 Subject: [PATCH 17/35] sdew --- app/views/contests/show_attendingcontest.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index f3f788c64..df6b81944 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -265,7 +265,7 @@
-
+
简介: <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> From cea41a7aab2de88ee9145d3366c2809b4c026fb0 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 14 May 2014 18:10:08 +0800 Subject: [PATCH 18/35] df --- app/views/contests/show_attendingcontest.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index df6b81944..3a50c3a79 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -273,12 +273,12 @@
- 发布时间:<%= format_time c_softapplication.created_at %> - 发布人员:<%= c_softapplication.softapplication.user.name %> + 参赛时间:<%= format_time c_softapplication.created_at %> + 参赛代表:<%= c_softapplication.softapplication.user.name %>
-
+
最终得分:<%= c_softapplication.softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分 From 1a7c82174c1f6a3b2da4c17543a30bc9de48074e Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Thu, 15 May 2014 10:05:05 +0800 Subject: [PATCH 19/35] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/open_source_projects_helper.rb | 4 ++++ db/migrate/20140515013449_add_author_to_relative_memo.rb | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 db/migrate/20140515013449_add_author_to_relative_memo.rb diff --git a/app/helpers/open_source_projects_helper.rb b/app/helpers/open_source_projects_helper.rb index f758580d9..ce1593cf1 100644 --- a/app/helpers/open_source_projects_helper.rb +++ b/app/helpers/open_source_projects_helper.rb @@ -34,4 +34,8 @@ module OpenSourceProjectsHelper def get_open_source_projects_by_tag(tag_name) OpenSourceProject.tagged_with(tag_name).order('created_at desc') end + + def show_origin(url) + + end end diff --git a/db/migrate/20140515013449_add_author_to_relative_memo.rb b/db/migrate/20140515013449_add_author_to_relative_memo.rb new file mode 100644 index 000000000..4a9ecd8d7 --- /dev/null +++ b/db/migrate/20140515013449_add_author_to_relative_memo.rb @@ -0,0 +1,6 @@ +class AddAuthorToRelativeMemo < ActiveRecord::Migration + def change + add_column :relative_memos, :username, :string + add_column :relative_memos, :userhomeurl, :string + end +end From f88322f2a1c374eb2cc1fd2b155e230f763cdb1b Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 10:06:51 +0800 Subject: [PATCH 20/35] =?UTF-8?q?=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E6=89=98=E7=AE=A1=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BD=91=E5=9D=80+=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/views/softapplications/show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 09eb18ae7..4190330e7 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -47,7 +47,8 @@ 发布时间:<%=format_time @softapplication.created_at %> - 托管项目网址:<%=@softapplication.deposit_project_url%> + <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> + From 65f1e2a8d132e4d196c5b2f312493686f9642931 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 10:25:24 +0800 Subject: [PATCH 21/35] =?UTF-8?q?=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E6=89=98=E7=AE=A1=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=BD=91=E5=9D=80+=E8=B6=85=E9=93=BE=E6=8E=A5+?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E7=BD=91=E5=9D=80=E6=98=AF=E5=90=A6=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 4190330e7..a02700675 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -43,12 +43,15 @@ 开发人员:<%= @softapplication.application_developers %> - 平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> - 发布时间:<%=format_time @softapplication.created_at %> + 平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> + 发布时间:<%=format_time @softapplication.created_at %> - <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> - + + <% unless @softapplication.deposit_project_url.nil? %> + <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> + <% end %> + From 74169221a3dc8d671785862b909166bb0cb78b3b Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Thu, 15 May 2014 10:33:52 +0800 Subject: [PATCH 22/35] 1234 --- db/migrate/20140515013449_add_author_to_relative_memo.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/migrate/20140515013449_add_author_to_relative_memo.rb b/db/migrate/20140515013449_add_author_to_relative_memo.rb index 4a9ecd8d7..ba097ac4c 100644 --- a/db/migrate/20140515013449_add_author_to_relative_memo.rb +++ b/db/migrate/20140515013449_add_author_to_relative_memo.rb @@ -2,5 +2,6 @@ class AddAuthorToRelativeMemo < ActiveRecord::Migration def change add_column :relative_memos, :username, :string add_column :relative_memos, :userhomeurl, :string + add_column :relative_memos, :date_collected, :date end end From bb3536a7d5119d5c201ea3c1765c50298f5827ec Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 10:46:05 +0800 Subject: [PATCH 23/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E5=8F=82?= =?UTF-8?q?=E8=B5=9B=E4=BD=9C=E5=93=81=E9=A1=B5=E9=9D=A2=E4=B8=AD=E6=9C=80?= =?UTF-8?q?=E7=BB=88=E5=BE=97=E5=88=86=E5=92=8C=E6=89=93=E5=88=86=E6=80=BB?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E5=92=8C=E4=B8=8B=E9=9D=A2=E6=96=87=E5=AD=97?= =?UTF-8?q?=E7=9A=84=E5=89=A7=E4=B8=AD=E5=AF=B9=E5=85=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index a02700675..c077bc822 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -86,14 +86,14 @@ <% end %>
-
-
最终得分
-
<%=@softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分
-
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
+
+
最终得分
+
<%=@softapplication.average(:quality).try(:avg).try(:round, 2).to_i.to_s%>分
+
<%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>
-
+
打分总人数
-
<%= @softapplication.raters(:quality).count%>
+
<%= @softapplication.raters(:quality).count%>
From a0a2d04bd748d64700aece476de64fe0567366c5 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 15:07:20 +0800 Subject: [PATCH 24/35] =?UTF-8?q?=E5=8F=82=E8=B5=9B=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8F=96=E5=87=BA=E6=8F=90=E4=BA=A4=E7=9A=84=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 3a50c3a79..968ad7588 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -187,12 +187,10 @@
- - 发布时间: - <%= format_time c_project.created_at%> - - + 参赛时间:<%= format_time c_project.created_at%> + 参赛代表:<%= c_project.user.name %>
+
From 44ec6eabf63903599e5b384948e264a74d7e859a Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 16:50:30 +0800 Subject: [PATCH 25/35] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E4=B8=AD=E5=8F=82=E8=B5=9B=E5=BA=94=E7=94=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=98=BE=E7=A4=BA=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 968ad7588..fcf204500 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -312,8 +312,8 @@ <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> - - <%= toggle_link '评奖', c_softapplication.id.to_s %> +
+ <%= toggle_link '评奖', c_softapplication.id.to_s %> - +
<% end %>
From 9cdd101cc7d81e39764fd74f8fc4087e766458cd Mon Sep 17 00:00:00 2001 From: xianbo Date: Thu, 15 May 2014 17:10:02 +0800 Subject: [PATCH 26/35] fix --- app/views/repositories/show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 09ab9738f..d11fd2564 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -36,7 +36,7 @@

git add .

git commit -m "first commit"

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u origin master:matser

+

git push -u origin master:master

从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:

@@ -45,7 +45,7 @@

git add .

git commit -m "first commit"

git config http.postBuffer 524288000 #设置本地post缓存为500MB

-

git push -u trustie master:matser

+

git push -u trustie master:master

<%= link_to "李海提供", user_path(646)%>

From 73175aa9b8156eb06c3ee78b5cba9d91a6343995 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 15 May 2014 17:26:39 +0800 Subject: [PATCH 27/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A5=BD=E4=BA=86?= =?UTF-8?q?=E5=8F=82=E5=8A=A0=E7=AB=9E=E8=B5=9B=E7=9A=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 119 +++++++++--------- 1 file changed, 59 insertions(+), 60 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index fcf204500..09390ffd2 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -175,10 +175,63 @@ <% if c_project.project %>
- - 参赛作品: - <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> -
+
+
参赛作品: <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> +
+ + + + <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> + <% if @contest.deadline < Date.today %> + <%= l(:label_noawards)%> + <% else%> + <%= l(:label_noawards_current)%> + <% end %> + <% else %> + <% case get_prize(c_project) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png")%> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png")%> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png")%> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png")%> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png")%> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png")%> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png")%> + <% end %> + <% end %> + + + + + + <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + + <%= toggle_link '评奖', c_project.id.to_s %> + + + + <% end %> +
+
+

@@ -192,61 +245,7 @@
- - - - - <% if get_prize(c_project).nil? or get_prize(c_project) == "" %> - <% if @contest.deadline < Date.today %> - <%= l(:label_noawards)%> - <% else%> - <%= l(:label_noawards_current)%> - <% end %> - <% else %> - <% case get_prize(c_project) %> - <% when '-1' %> - <%= image_tag("/images/bid/special_reward.png")%> - <% when '0' %> - <%= image_tag("/images/bid/first_reward.png")%> - <% when '1' %> - <%= image_tag("/images/bid/second_reward.png")%> - <% when '2' %> - <%= image_tag("/images/bid/third_reward.png")%> - <% when '3' %> - <%= image_tag("/images/bid/forth_reward.png")%> - <% when '4' %> - <%= image_tag("/images/bid/fifth_reward.png")%> - <% when '5' %> - <%= image_tag("/images/bid/qualified.png")%> - <% end %> - <% end %> - - - - - - <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> - - <%= toggle_link '评奖', c_project.id.to_s %> - - - - <% end %> - - - +
<% end %> @@ -284,7 +283,7 @@ <% if get_prize(c_softapplication).nil? or get_prize(c_softapplication) == "" %> <% if @contest.deadline < Date.today %> - <%= l(:label_noawards)%> + <%= l(:label_noawards)%> <% else%> <%= l(:label_noawards_current)%> <% end %> From 84ae8a1cde225ba73aad279be4d953d7bc3ec5f3 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Fri, 16 May 2014 16:22:59 +0800 Subject: [PATCH 28/35] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BA=86=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E5=8F=82=E8=B5=9B=E4=BD=9C=E5=93=81=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 09390ffd2..ad8222224 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -81,11 +81,11 @@ - - - +
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %> @@ -160,7 +146,7 @@ <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
  • -
    +
    <%= image_tag('/images/contest1.png')%>
    @@ -192,7 +178,7 @@
    -

    +

    问题和反馈动态 <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> @@ -207,11 +193,11 @@ <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
    - <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 + <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前 由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %> 发表 - 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>) + 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)

  • <% end %> @@ -228,7 +214,7 @@ <% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
  • -
    +
    <%= image_tag('/images/app1.png')%>
    @@ -237,7 +223,7 @@
    - ><%=softapplication.description.truncate(50, omission: '...')%> + ><%=softapplication.description.to_s.truncate(50, omission: '...')%>

    diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 8e4db7fe6..81160fa93 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -609,6 +609,14 @@ function toggleAndSettingWordsVal(parent_widget, text_widget, value){ text_widget.val(value) parent_widget.slideToggle(400) } +function transpotUrl (scope) { + $(scope).each(function(){ + var tmpContent = $(this).html(); + tmpContent = tmpContent.replace(/(^|[^\"\'])(http|ftp|mms|rstp|news|https)(\:\/\/[^<\s\+,,]+)/gi,"$1$2$3<\/a>"); + // tmpContent = tmpContent.replace(/(^|[^\/])(www\.[^<\s\+,,]+)/gi,"$1$2"); + $(this).html(tmpContent); + }); +} $(document).ready(setupAjaxIndicator); $(document).ready(hideOnLoad); From 7189d9a14aa10193ebbb9b69e898da07c48cc0cb Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 14:52:30 +0800 Subject: [PATCH 31/35] course_form --- app/views/users/_course_form.html.erb | 113 +++++++++++++------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index cadebff41..058c92d4e 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,56 +1,59 @@
    -
      - <% for membership in memberships %> -
    • - - - - - -
      <%= image_tag(url_to_avatar(membership.project), :class => 'avatar') %> - - - - - - - - -
      - <%= link_to_project(membership.project) %> - - - <%=render :partial => 'courses/set_course_time', :locals => {:project => membership.project} %> - <% if User.current == @user %> - <% (membership.roles).each do |role| %> - <% unless (role == Role.find(9) || role == Role.find(3)) %> - <%= join_in_course(membership.project, User.current)%>     - <% end %> - <% end %> - <% else %> - <% end %> - - <%= l(:label_x_base_courses_member, :count => membership.project.members.count) %>(<%= link_to "#{membership.project.members.count}", project_member_path(membership.project), :course =>'1' %>)   - <%= l(:label_homework) %> (<%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %>) -    - <%= l(:label_course_news)%> (<%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %>) -
      -

      - <%= membership.project.description %> -

      - - - <% @course = Course.find_by_extra(membership.project.identifier)%> - <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> - <%= l(:label_main_teacher) %> : <%= link_to(@course.teacher.name, user_path(@course.teacher)) %> - <%= l(:label_course_term) %> : <%= @course.time %><%= @course.term %> - - <% end %> -
      -
    • - - <% end %> - -
    -
    - <%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file +
      + <% for membership in memberships %> +
    • + + + + + +
      <%= image_tag(url_to_avatar(membership.project), :class => 'avatar') %> + + + + + + + + + + +
      + <%= link_to_project(membership.project) %> + + <%= render :partial => 'courses/set_course_time', :locals => {:project => membership.project} %> + <% if User.current == @user %> + <% (membership.roles).each do |role| %> + <% unless (role == Role.find(9) || role == Role.find(3)) %> + <%= join_in_course(membership.project, User.current) %>     + <% end %> + <% end %> + <% else %> + <% end %> + <%= l(:label_x_base_courses_member, :count => membership.project.members.count) %> + (<%= "#{membership.project.members.count}" %>)   + <%= l(:label_homework) %> + (<%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %>) +    + <%= l(:label_course_news) %> + (<%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %>) +
      +

      + <%= membership.project.description %> +

      + + <% @course = Course.find_by_extra(membership.project.identifier) %> + <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> + <%= l(:label_main_teacher) %> + : <%= link_to(@course.teacher.name, user_path(@course.teacher)) %> + <%= l(:label_course_term) %> + : <%= @course.time %><%= @course.term %> + <% end %> +
      +
      +
    • + + <% end %> +
    +
    +<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file From 4156983494500a24ed4fdf9352b86f2f7bb4c205 Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 20 May 2014 15:05:54 +0800 Subject: [PATCH 32/35] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BC=A9=E7=95=A5=E5=9B=BE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 20 ++++++++++++++++++-- app/models/attachment.rb | 1 - app/views/attachments/_links.html.erb | 2 +- app/views/users/_my_course.html.erb | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6b8525a00..0c4514769 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -182,11 +182,27 @@ module ApplicationHelper end def thumbnail_tag(attachment) - link_to image_tag(thumbnail_path(attachment)), - named_attachment_path(attachment, attachment.filename), + imagepath = named_attachment_path(attachment, attachment.filename) + link_to image_tag(imagepath), + imagepath , :title => attachment.filename end + # 图片缩略图链接 + def thumbnail_small_tag(attachment) + imagesize = attachment.thumbnail(:size => "200*200") + imagepath = named_attachment_path(attachment, attachment.filename) + if imagesize + link_to image_tag(imagesize), + imagepath, + :title => attachment.filename + else + link_to image_tag(imagepath , height: '200', width: '250'), + imagepath, + :title => attachment.filename + end + end + def toggle_link(name, id, options={}) onclick = "$('##{id}').toggle(); " onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ") diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 661762e5c..aff63439e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -228,7 +228,6 @@ class Attachment < ActiveRecord::Base end size = 100 unless size > 0 target = File.join(self.class.thumbnails_storage_path, "#{id}_#{digest}_#{size}.thumb") - begin Redmine::Thumbnail.generate(self.diskfile, target, size) rescue => e diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index c135ee214..f73df8fb4 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -33,7 +33,7 @@ <% if images.any? %>
    <% images.each do |attachment| %> -
    <%= thumbnail_tag(attachment) %>
    +
    <%= thumbnail_small_tag(attachment) %>
    <% end %>
    <% end %> diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index 2fb2b5bde..8feb0ecca 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -12,7 +12,7 @@ <% end %> <% else %>

    - <%=l(:label_course_doing)%>(<%=@memberships_doing.count%>) + <%=l(:label_course_doing)%>(<%=@memberships_doing.count%>) <%= link_to"#{l(:label_course_new)}",{:controller=>'projects',:action=>'new', :course => 1, :project_type => 1}, :class => 'icon icon-add' if @user == User.current %>

    From dac992548a03698c68967f309f68bf13191e50db Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 14:52:30 +0800 Subject: [PATCH 33/35] course_form --- app/views/users/_course_form.html.erb | 113 +++++++++++++------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index cadebff41..058c92d4e 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,56 +1,59 @@

    -
      - <% for membership in memberships %> -
    • - - - - - -
      <%= image_tag(url_to_avatar(membership.project), :class => 'avatar') %> - - - - - - - - -
      - <%= link_to_project(membership.project) %> - - - <%=render :partial => 'courses/set_course_time', :locals => {:project => membership.project} %> - <% if User.current == @user %> - <% (membership.roles).each do |role| %> - <% unless (role == Role.find(9) || role == Role.find(3)) %> - <%= join_in_course(membership.project, User.current)%>     - <% end %> - <% end %> - <% else %> - <% end %> - - <%= l(:label_x_base_courses_member, :count => membership.project.members.count) %>(<%= link_to "#{membership.project.members.count}", project_member_path(membership.project), :course =>'1' %>)   - <%= l(:label_homework) %> (<%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %>) -    - <%= l(:label_course_news)%> (<%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %>) -
      -

      - <%= membership.project.description %> -

      - - - <% @course = Course.find_by_extra(membership.project.identifier)%> - <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> - <%= l(:label_main_teacher) %> : <%= link_to(@course.teacher.name, user_path(@course.teacher)) %> - <%= l(:label_course_term) %> : <%= @course.time %><%= @course.term %> - - <% end %> -
      -
    • - - <% end %> - -
    -
    - <%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file +
      + <% for membership in memberships %> +
    • + + + + + +
      <%= image_tag(url_to_avatar(membership.project), :class => 'avatar') %> + + + + + + + + + + +
      + <%= link_to_project(membership.project) %> + + <%= render :partial => 'courses/set_course_time', :locals => {:project => membership.project} %> + <% if User.current == @user %> + <% (membership.roles).each do |role| %> + <% unless (role == Role.find(9) || role == Role.find(3)) %> + <%= join_in_course(membership.project, User.current) %>     + <% end %> + <% end %> + <% else %> + <% end %> + <%= l(:label_x_base_courses_member, :count => membership.project.members.count) %> + (<%= "#{membership.project.members.count}" %>)   + <%= l(:label_homework) %> + (<%= link_to (membership.project.homeworks.count), {:controller => 'projects', :action => 'homework', :id => membership.project.identifier} %>) +    + <%= l(:label_course_news) %> + (<%= link_to (membership.project.news.count), {:controller => 'news', :action => 'index', :project_id => membership.project.identifier} %>) +
      +

      + <%= membership.project.description %> +

      + + <% @course = Course.find_by_extra(membership.project.identifier) %> + <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> + <%= l(:label_main_teacher) %> + : <%= link_to(@course.teacher.name, user_path(@course.teacher)) %> + <%= l(:label_course_term) %> + : <%= @course.time %><%= @course.term %> + <% end %> +
      +
      +
    • + + <% end %> +
    +
  • +<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file From 85c77ca074ddc9e019324bb38a416408560a7400 Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 15:37:05 +0800 Subject: [PATCH 34/35] xss, ckeditor js bug. --- app/views/memos/show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index fcd10a011..91bb1387d 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -110,8 +110,7 @@ <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> -
    <%=h reply.content.html_safe %>
    - +
    <%=h sanitize(reply.content.html_safe) %>

    <% if reply.attachments.any?%> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> @@ -144,6 +143,7 @@ \ No newline at end of file From 4aed14228a830d9f590eb874abc65256ce5d2f3e Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 15:53:23 +0800 Subject: [PATCH 35/35] project/course/ members remove link --- app/views/projects/_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/_course.html.erb b/app/views/projects/_course.html.erb index 58168c999..adc7c9306 100644 --- a/app/views/projects/_course.html.erb +++ b/app/views/projects/_course.html.erb @@ -45,7 +45,7 @@ <%= content_tag('span', l(:label_x_data,:count => files_count)) %>

    - <%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %> + <%= content_tag('span', "#{@project.members.count}", :class => "info") %> <%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>