From 47b3c55b40267853fc2df8d37e93feac48d3590a Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Mon, 12 May 2014 15:46:22 +0800 Subject: [PATCH 01/41] =?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/41] =?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/41] =?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/41] =?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/41] =?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/41] =?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/41] 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/41] =?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/41] =?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/41] =?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/41] =?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/41] 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/41] 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/41] =?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/41] =?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/41] =?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/41] 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/41] 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/41] =?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/41] =?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/41] =?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/41] 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/41] =?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/41] =?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/41] =?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/41] 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/41] =?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/41] =?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 4d21933e09b7756b7594e4e75d4904c4f4972b37 Mon Sep 17 00:00:00 2001 From: nwb Date: Tue, 20 May 2014 11:33:17 +0800 Subject: [PATCH 31/41] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0=E4=B8=8B=E8=BD=BD=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=202.=E6=95=99=E5=B8=88=E7=9A=84=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 55 ++++++++- app/controllers/users_controller.rb | 60 +++++++++- app/views/attachments/upload.js.erb | 3 +- app/views/files/_new.html.erb | 27 ++++- app/views/files/index.html.erb | 32 ++++- app/views/tags/_tag.html.erb | 2 +- app/views/tags/_tagEx.html.erb | 165 ++++++++++++++++++++++++++ app/views/users/_course_form.html.erb | 2 +- app/views/users/_my_course.html.erb | 11 +- app/views/users/tag_saveEx.js.erb | 20 ++++ config/locales/en.yml | 4 +- config/locales/zh.yml | 4 +- config/routes.rb | 1 + 13 files changed, 359 insertions(+), 27 deletions(-) create mode 100644 app/views/tags/_tagEx.html.erb create mode 100644 app/views/users/tag_saveEx.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index a2dd8c869..f9236d0b7 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -52,16 +52,59 @@ class FilesController < ApplicationController end def create - container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) - attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type]) - render_attachment_warning_if_needed(container) + if params[:tag_name] + tag_saveEx + render :text =>"success" + else + @addTag=false + container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) + attachments = Attachment.attach_filesex(container, params[:attachments],params[:attachment_type]) + render_attachment_warning_if_needed(container) - if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') - Mailer.attachments_added(attachments[:files]).deliver + if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + Mailer.attachments_added(attachments[:files]).deliver + end + redirect_to project_files_path(@project) end - redirect_to project_files_path(@project) end + def tag_saveEx + @tags = params[:tag_name][:name] + @obj_id = params[:object_id] + @obj_flag = params[:object_flag] + + case @obj_flag + when '1' then + @obj = User.find_by_id(@obj_id) + when '2' then + @obj = Project.find_by_id(@obj_id) + when '3' then + @obj = Issue.find_by_id(@obj_id) + when '4' then + @obj = Bid.find_by_id(@obj_id) + when '5' then + @obj = Forum.find_by_id(@obj_id) + when '6' + @obj = Attachment.find_by_id(@obj_id) + when '7' then + @obj = Contest.find_by_id(@obj_id) + when '8' + @obj = OpenSourceProject.find_by_id(@obj_id) + else + @obj = nil + end + unless @obj.nil? + @obj.tag_list.add(@tags.split(",")) + else + return + end + if @obj.save + ## 执行成功的操作。 + else + #捕获异常 + end + end + # 返回制定资源类型的资源列表 def getattachtype sort_init 'created_on', 'desc' diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9a21e26f2..7365e4048 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -30,7 +30,7 @@ class UsersController < ApplicationController #Ended by young - before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, + before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index] #edit has been deleted by huang, 2013-9-23 @@ -39,10 +39,10 @@ class UsersController < ApplicationController :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index] before_filter :auth_user_extension, only: :show - accept_api_auth :index, :show, :create, :update, :destroy,:tag_save + accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx #william - before_filter :require_login, :only => :tag_save + before_filter :require_login, :only => [:tag_save,:tag_saveEx] helper :sort @@ -209,6 +209,8 @@ class UsersController < ApplicationController ## 判断课程是否过期 [需封装] @memberships_doing = [] @memberships_done = [] + @OwningCouses =[] + @JoinCouses=[] now_time = Time.now.year @memberships.map { |e| end_time = e.project.course_extra.get_time.year @@ -218,6 +220,12 @@ class UsersController < ApplicationController else @memberships_doing.push e end + + if e.project.course_extra.tea_id == User.current.id + @OwningCouses.push e + else + @JoinCouses.push e + end } # respond_to do |format| # format.html @@ -683,11 +691,51 @@ class UsersController < ApplicationController #捕获异常 end respond_to do |format| - format.html format.js - end + format.html + end + end + + def tag_saveEx + @tags = params[:tag_name][:name] + @obj_id = params[:obj_id] + @obj_flag = params[:obj_flag] + + case @obj_flag + when '1' then + @obj = User.find_by_id(@obj_id) + when '2' then + @obj = Project.find_by_id(@obj_id) + when '3' then + @obj = Issue.find_by_id(@obj_id) + when '4' then + @obj = Bid.find_by_id(@obj_id) + when '5' then + @obj = Forum.find_by_id(@obj_id) + when '6' + @obj = Attachment.find_by_id(@obj_id) + when '7' then + @obj = Contest.find_by_id(@obj_id) + when '8' + @obj = OpenSourceProject.find_by_id(@obj_id) + else + @obj = nil + end + unless @obj.nil? + @obj.tag_list.add(@tags.split(",")) + else + return + end + if @obj.save + ## 执行成功的操作。 + else + #捕获异常 + end + respond_to do |format| + format.js + format.html + end end - ###add by huang def user_watchlist end diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb index 63492688a..674d73b79 100644 --- a/app/views/attachments/upload.js.erb +++ b/app/views/attachments/upload.js.erb @@ -12,5 +12,6 @@ fileSpan.find('a.remove-upload') }) .off('click'); var divattach = fileSpan.find('div.div_attachments'); -divattach.html('<%= j(render :partial => 'tags/tag', :locals => {:obj => @attachment, :object_flag => "6"})%>'); +divattach.html('<%#= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>'); + <% end %> diff --git a/app/views/files/_new.html.erb b/app/views/files/_new.html.erb index 9d62ca37e..a01143e0b 100644 --- a/app/views/files/_new.html.erb +++ b/app/views/files/_new.html.erb @@ -2,9 +2,8 @@ <% versions = project.versions.sort %> <% attachmenttypes = project.attachmenttypes %> <%= error_messages_for 'attachment' %> -<%= form_tag(project_files_path(project), :multipart => true, :class => "tabular") do %> +<%= form_tag(project_files_path(project), :multipart => true,:name=>"upload_form", :class => "tabular") do %>
    -

    @@ -34,4 +33,26 @@ <%= submit_tag l(:button_add) %> <% end %> -
    \ No newline at end of file +
    + + diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index a4f63e4b2..231be8beb 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -25,9 +25,10 @@ :onchange => "attachment_contenttypes_searchex(this.value)" %> <% end %> - + + - - +
    -
    作品简介:
    -
    <%= @softapplication.description %>
    + +
    作品简介:
    +
    + +
    <%= @softapplication.description %>
    -
    作品得分:
    - -
    -
    -
    得分比例
    -
    - <% 100.step(20,-20) do |star| %> -
    -
    -
    -
    -
    -
    - <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %> -
    - <% 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.raters(:quality).count%>
    -
    -
    +
    作品得分:
    + +
    +
    +
    得分比例
    +
    + <% 100.step(20, -20) do |star| %> +
    +
    +
    +
    +
    +
    + <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %> +
    + <% 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.raters(:quality).count %>
    +
    +
    -
    作品截图:
    -
    - <% @image_results.take(4).each do |attachment| %> - <%= link_to_attachment_img attachment, :class => "soft-application", :download => "true" %> - <% end %> -
    -
    + +
    作品截图:
    +
    + +
    +
      + <% @image_results.take(4).each do |attachment| %> +
    • + + <%= link_to_attachment_img attachment, :class => "soft-application", :download => "true"%> +
    • + <% end %> +
    +
    +
    - +
    -
    作品评论:
    -
    评分: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %>(您可以重新打分,打分结果以最后一次打分为主!)
    - +
    作品评论:
    +
    评分: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %> + (您可以重新打分,打分结果以最后一次打分为主!)
    +
    - <%= render :partial => 'message_history', :locals => { :contest => @softapplication, :journals => @jour, :state => false} %> + <%= render :partial => 'message_history', :locals => {:contest => @softapplication, :journals => @jour, :state => false} %>
    -<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
    diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index e1088c8c0..0135b1e46 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -218,7 +218,6 @@ body { border-style: solid; border-width: 1px; color: #222222; - font-family: "Helvetica Neue"; font-size: 1.2em; outline: medium none; padding: 8px; @@ -1140,3 +1139,54 @@ div.pagination { .all_browse_div table td{ vertical-align: middle; } + +/* softapplication show +*******************************************************************************/ +.softapplication-img { + margin: 0; + padding: 0; +} +.softapplication-img { + margin: 5px auto; + width: 860px; + max-height: 640px; + overflow: hidden; + box-shadow: 5px 5px 20px 5px #ccc; + border-radius: 5px; +} +.soft-application { + width: 326px; + height: 580px; +} +.softapplication-img .title{ + width: 326px; + position: absolute; + left: 0; + bottom: 0; +} +.softapplication-img .title a{ + display: block; + text-decoration: none; + color: #fff; + font-size: 20px; + padding: 20px; + background: rgba(0,0,0,0.5); +} +.softapplication-img li{ + list-style-type: none; + position: relative; + float: left; + width: 205px; + -webkit-transition: all 0.5s; + -moz-transition: all 0.5s; + -ms-transition: all 0.5s; + -o-transition: all 0.5s; + transition: all 0.5s; + box-shadow: -1px 0 3px 1px rgba(0,0,0,0.3); +} +.softapplication-img ul:hover li{ + width: 160px; +} +.softapplication-img ul li:hover{ + width: 326px; +} From 624a7f7bddd94dcca6b77f0e70ddb18b6cbf8bc6 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 21 May 2014 11:03:16 +0800 Subject: [PATCH 39/41] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E7=9A=84tag=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=BA=E4=B8=80=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_show_all_attachment.html.erb | 8 +++---- app/views/files/_sort_by_attachtypel.html.erb | 21 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb index d34f95f78..07dc6a27f 100644 --- a/app/views/files/_show_all_attachment.html.erb +++ b/app/views/files/_show_all_attachment.html.erb @@ -20,7 +20,6 @@ <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> - <%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %> @@ -52,14 +51,15 @@ <%= link_to(image_tag('delete.png'), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - + + <% end -%> diff --git a/app/views/files/_sort_by_attachtypel.html.erb b/app/views/files/_sort_by_attachtypel.html.erb index 9df26d7ed..01c57c490 100644 --- a/app/views/files/_sort_by_attachtypel.html.erb +++ b/app/views/files/_sort_by_attachtypel.html.erb @@ -20,7 +20,6 @@ <%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%> <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %> <%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %> - <%= sort_header_tag('tags', :caption => l(:label_tag), :id => "vzebra-tag") %> @@ -48,15 +47,17 @@ <%= link_to(image_tag('delete.png'), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - + + + <% end -%> <% end -%> From 5a5db45af24f61c101fb2adcd514c987e1e67818 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 21 May 2014 14:44:53 +0800 Subject: [PATCH 40/41] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 7 ++++++- app/controllers/projects_controller.rb | 6 +++--- app/models/homework_attach.rb | 7 +++++++ lib/redmine.rb | 5 +++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d848b3c37..ed27d9388 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -209,7 +209,12 @@ private end def read_authorize - @attachment.visible? ? true : deny_access + if @attachment.container_type == "HomeworkAttach" + true + #User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access + else + @attachment.visible? ? true : deny_access + end end def delete_authorize diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d9996e739..32fc3dd57 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -33,12 +33,12 @@ class ProjectsController < ApplicationController menu_item l(:label_course_news), :only => :index - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise] + before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] - before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen] - before_filter :authorize_global, :only => [:new, :create] + before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches] + before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :file, :statistics, :watcherlist diff --git a/app/models/homework_attach.rb b/app/models/homework_attach.rb index e395e65e5..ac285e606 100644 --- a/app/models/homework_attach.rb +++ b/app/models/homework_attach.rb @@ -29,6 +29,13 @@ class HomeworkAttach < ActiveRecord::Base result end + def project + work = HomeworkForCourse.find_by_bid_id(self.bid_id) + if work + work.project + end + end + def add_jours options jfm = self.journals_for_messages.build(options) jfm.save diff --git a/lib/redmine.rb b/lib/redmine.rb index d22feb9fc..904be7c25 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -178,6 +178,11 @@ Redmine::AccessControl.map do |map| map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} end + #作业模块权限 + map.project_module :bids do |map| + map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true + end + map.project_module :boards do |map| map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true From 19aba25625528087c894b483b248498646a5b755 Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 21 May 2014 15:30:54 +0800 Subject: [PATCH 41/41] course revert search project --- app/models/course.rb | 2 +- app/models/user.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index 0420b1744..de383a1f5 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -2,7 +2,7 @@ class Course < ActiveRecord::Base include Redmine::SafeAttributes attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password - belongs_to :project, :class_name => 'Project', :foreign_key => :extra # 定义一个project方法, 该方法通过extra来调用project表 + belongs_to :project, :class_name => 'Project', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 has_many :bid diff --git a/app/models/user.rb b/app/models/user.rb index 840275794..8017ed5f8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -18,6 +18,11 @@ require "digest/sha1" class User < Principal + TEACHER = 0 + STUDENT = 1 + ENTERPRISE = 2 + DEVELOPER = 3 + include Redmine::SafeAttributes # Different ways of displaying/sorting users
    diff --git a/app/views/users/_my_course.html.erb b/app/views/users/_my_course.html.erb index b93afd41f..2fb2b5bde 100644 --- a/app/views/users/_my_course.html.erb +++ b/app/views/users/_my_course.html.erb @@ -15,9 +15,14 @@ <%=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 %>

    -
    - <%= render :partial => 'course_form', :locals => {:memberships => @memberships_doing}%> -
    +

    + <%= l(:label_created_course) %> +

    <%= render :partial => 'course_form', :locals => {:memberships => @OwningCouses}%> +

    +
    +

    <%= l(:label_joined_course) %> +

    <%= render :partial => 'course_form', :locals => {:memberships => @JoinCouses}%> +

    diff --git a/app/views/users/tag_saveEx.js.erb b/app/views/users/tag_saveEx.js.erb new file mode 100644 index 000000000..d567ee5de --- /dev/null +++ b/app/views/users/tag_saveEx.js.erb @@ -0,0 +1,20 @@ +<% if @obj_flag == '3'%> + +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$('#put-tag-form-issue').hide(); +$('#name-issue').val(""); +<% elsif @obj_flag == '6'%> +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%>").hide(); +$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val(""); +<% else %> + +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#put-tag-form #name').val(""); +//$('#put-tag-form').hide(); +<% end %> + diff --git a/config/locales/en.yml b/config/locales/en.yml index 0215d43b6..58ce0dd29 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1122,6 +1122,8 @@ en: label_activities_settings: Display settings #end + label_joined_course: Joined Courses + label_created_course: Created Courses #huang label_file_new: Download @@ -1611,4 +1613,4 @@ en: # ajax异步验证 - modal_valid_passing: can be used. + modal_valid_passing: can be used. diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 666b28740..0c375a67c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1670,7 +1670,9 @@ zh: label_no_current_participate: 该竞赛暂无参与者 #end - + + label_joined_course: 参加的课程 + label_created_course: 创建的课程 label_course: 课程 label_course_new: 新建课程 label_course_join_student: 加入课程 diff --git a/config/routes.rb b/config/routes.rb index 194776853..58e1475c2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -225,6 +225,7 @@ RedmineApp::Application.routes.draw do match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' ################# added by william match 'users/tag_save', :to => 'users#tag_save', :via => :post, :as => 'tag' + match 'users/tag_saveEx', :to => 'users#tag_saveEx', :via => :post post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' delete 'watchers/watch', :to => 'watchers#unwatch' From b3489d3e6819941c961e4c318f22075a35a13432 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 20 May 2014 11:36:01 +0800 Subject: [PATCH 32/41] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8E=E8=B7=B3=E8=BD=AC=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 51259bb5d..d848b3c37 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -124,7 +124,12 @@ class AttachmentsController < ApplicationController end respond_to do |format| - format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum,@attachment.container) } + if @project.nil? + format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum,@attachment.container) } + else + format.html { redirect_to_referer_or project_path(@project)} + end + format.js end end From 7189d9a14aa10193ebbb9b69e898da07c48cc0cb Mon Sep 17 00:00:00 2001 From: yanxd Date: Tue, 20 May 2014 14:52:30 +0800 Subject: [PATCH 33/41] 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 34/41] =?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 35/41] 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 36/41] 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 37/41] 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)) %>

    From 0ab17f1e909fdeeda766ddcdbc368317bd93c10a Mon Sep 17 00:00:00 2001 From: yanxd Date: Wed, 21 May 2014 09:45:16 +0800 Subject: [PATCH 38/41] contest image show --- app/views/softapplications/show.html.erb | 213 +++++++++++------------ public/stylesheets/nyan.css | 52 +++++- 2 files changed, 154 insertions(+), 111 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index c077bc822..36167880c 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -1,146 +1,139 @@ -<%=render :partial => 'layouts/base_softapplication_top_content'%> - - +<%= render :partial => 'layouts/base_softapplication_top_content' %>

    <%= notice %>

    -
    - - - - - - - - - <% contest = @softapplication.contests.first %> - - - - - - - - + + - + + + + + + + + + +
    <%= @softapplication.name %> - <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: { confirm: '您确定要删除吗?' } if @softapplication.destroyable_by? User.current %>  - <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> -
    所属类别:<%= @softapplication.app_type_name %>所属竞赛:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛'%>
    发布人员:<%= @softapplication.user.name %>系统支持:<%= @softapplication.android_min_version_available %>
    - 作品下载: +
    + + + + + + + + + <% contest = @softapplication.contests.first %> + + + + + + + + + - - - - - - - - - - - -
    <%= @softapplication.name %> + <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: {confirm: '您确定要删除吗?'} if @softapplication.destroyable_by? User.current %>  + <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %> +
    所属类别:<%= @softapplication.app_type_name %>所属竞赛:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛' %>
    发布人员:<%= @softapplication.user.name %>系统支持:<%= @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} %> + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current)} %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> - 开发人员:<%= @softapplication.application_developers %>
    平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>发布时间:<%=format_time @softapplication.created_at %>
    - <% unless @softapplication.deposit_project_url.nil? %> - <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> - <% end %> -
    -
    开发人员:<%= @softapplication.application_developers %>
    平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>发布时间:<%= format_time @softapplication.created_at %>
    + <% unless @softapplication.deposit_project_url.nil? %> + <%= textilizable ("托管项目网址: " + @softapplication.deposit_project_url) %> + <% end %> +
    +
    +
    <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
    - +
    -
    - <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> - <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> -
    -
    - -
    +
    + <%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %> + <%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %> +
    +
    + +