From 31dff76b3a3c824aa720b412b4771016517d3fdc Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 6 May 2014 08:55:48 +0800 Subject: [PATCH 01/48] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E7=AB=9E=E8=B5=9B=E4=B8=AD=E5=8C=85=E5=90=AB=E7=9A=84?= =?UTF-8?q?app=E7=9A=84=E5=AD=97=E4=BD=93=E7=9A=84=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/contest.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index f17c7284a..3b645c611 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -152,7 +152,7 @@
<%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> - (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_softapplication_contest_path(contest), :target => "_blank") %>) + (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_softapplication_contest_path(contest), :target => "_blank") %>)
From d94e15cd94e94e1340eb3af413881761b7cda10c Mon Sep 17 00:00:00 2001 From: Wen Date: Tue, 6 May 2014 15:15:29 +0800 Subject: [PATCH 02/48] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=89=93=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/test/index.html.erb | 6 +- db/migrate/20140505082635_drop_user_scores.rb | 5 ++ .../20140505083218_create_user_levels.rb | 8 +++ .../20140505083430_create_user_scores.rb | 11 +++ db/schema.rb | 70 ++++++++++++++++--- 5 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20140505082635_drop_user_scores.rb create mode 100644 db/migrate/20140505083218_create_user_levels.rb create mode 100644 db/migrate/20140505083430_create_user_scores.rb diff --git a/app/views/test/index.html.erb b/app/views/test/index.html.erb index 17c7089d1..de889b15b 100644 --- a/app/views/test/index.html.erb +++ b/app/views/test/index.html.erb @@ -1,12 +1,12 @@

test

-<% users = User.all%> +<% user = User.find(1)%> -<% users.each do |user| %> + @@ -22,7 +22,7 @@ -<% end %> +
idnameCISfilecountissuecountlevelattachconut
<%= calculate_attachments(user) %>

diff --git a/db/migrate/20140505082635_drop_user_scores.rb b/db/migrate/20140505082635_drop_user_scores.rb new file mode 100644 index 000000000..fc65788f2 --- /dev/null +++ b/db/migrate/20140505082635_drop_user_scores.rb @@ -0,0 +1,5 @@ +class DropUserScores < ActiveRecord::Migration + def change + drop_table :user_scores + end +end diff --git a/db/migrate/20140505083218_create_user_levels.rb b/db/migrate/20140505083218_create_user_levels.rb new file mode 100644 index 000000000..f0e201212 --- /dev/null +++ b/db/migrate/20140505083218_create_user_levels.rb @@ -0,0 +1,8 @@ +class CreateUserLevels < ActiveRecord::Migration + def change + create_table :user_levels do |t| + t.integer :user_id + t.integer :level + end + end +end diff --git a/db/migrate/20140505083430_create_user_scores.rb b/db/migrate/20140505083430_create_user_scores.rb new file mode 100644 index 000000000..6c63aa327 --- /dev/null +++ b/db/migrate/20140505083430_create_user_scores.rb @@ -0,0 +1,11 @@ +class CreateUserScores < ActiveRecord::Migration + def change + create_table :user_scores do |t| + t.integer :user_id + t.integer :collaboration + t.integer :influence + t.integer :skill + t.integer :activity + end + end +end diff --git a/db/schema.rb b/db/schema.rb index fe23a1caa..2dd0f1515 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 => 20140505083430) 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 @@ -810,6 +858,11 @@ 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" + end + create_table "user_preferences", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.text "others" @@ -820,16 +873,11 @@ 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 "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" + t.integer "user_id" + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "activity" end create_table "user_statuses", :force => true do |t| From bb3c7f243273981a1130cf43b33e1eb3b3a5d92b Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Tue, 6 May 2014 16:01:22 +0800 Subject: [PATCH 03/48] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=89=80=E5=B1=9E?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=9A=84=E6=98=BE=E7=A4=BA=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 30a57b1a7..24a9a5914 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -16,7 +16,7 @@
<%= softapplication.description.truncate(95, omission: '...') %>
<%contest = softapplication.contests.first%> -

所属竞赛:<%= contest ? link_to(contest.name.truncate(10, omission: '...'), show_softapplication_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

+

所属竞赛:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_softapplication_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

所属类别:<%= softapplication.app_type_name.truncate(5, omission: '...') %>

系统支持:<%= softapplication.android_min_version_available %>

From 1471d78e63bb2a8e2f4e29eb2069503760199301 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Wed, 7 May 2014 08:13:08 +0800 Subject: [PATCH 04/48] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=B8=AD=E6=AF=8F=E4=B8=AA?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=8F=B3=E8=BE=B9=E4=B8=89=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E8=A1=8C=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 24a9a5914..a670c9fa5 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -14,7 +14,7 @@
<%= image_tag('/images/app1.png')%>
<%= softapplication.description.truncate(95, omission: '...') %>
-
+
<%contest = softapplication.contests.first%>

所属竞赛:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_softapplication_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

所属类别:<%= softapplication.app_type_name.truncate(5, omission: '...') %>

From fe151f9e29c055f8b545b0fdac414619e962aa75 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 8 May 2014 08:33:03 +0800 Subject: [PATCH 05/48] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=E2=80=9C=E6=88=91=E8=A6=81=E5=8F=82?= =?UTF-8?q?=E8=B5=9B=E2=80=9D=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 10 +++++++++- config/locales/zh.yml | 1 + config/routes.rb | 19 ++++++++++--------- lib/redmine.rb | 1 + 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 14395ac0b..830c74357 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -4,7 +4,8 @@ class ContestsController < ApplicationController menu_item :respond menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + 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, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -288,6 +289,13 @@ class ContestsController < ApplicationController end end + + ###我要参赛 + def show_attendingcontest + + end + + ###end ###添加已创建的参赛项目 def add project = Project.find(params[:contest]) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 26d3f6682..1b3d0e23c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1870,6 +1870,7 @@ zh: label_edit_softapplication: 修改应用 label_contest_delete: 删除竞赛 label_softapplication_list: 应用列表 + label_attending_contest: 我要参赛 label_coursefile_sharingarea: 课程资源共享区 label_sort_by_activity: 按动态数排序 diff --git a/config/routes.rb b/config/routes.rb index be0d11cea..c40c3b259 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,15 +67,16 @@ 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_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 'add' , via: [:get, :post] + match 'add_softapplication' , via: [:get, :post] + match 'create' , via: :post + match 'settings' , via: [:get, :post] end end diff --git a/lib/redmine.rb b/lib/redmine.rb index 2c935074b..583497841 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -281,6 +281,7 @@ 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 :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attending_contest # menu.push :result, { :controller => 'bids', :action => 'show_results' }, # :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p } end From fb3c513da2ad881340ec5423d2a1ca6197fec9ca Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 8 May 2014 09:30:52 +0800 Subject: [PATCH 06/48] =?UTF-8?q?=E7=BB=99=E2=80=9C=E6=88=91=E8=A6=81?= =?UTF-8?q?=E5=8F=82=E8=B5=9B=E2=80=9D=E5=BA=94=E7=94=A8=E4=BA=86base?= =?UTF-8?q?=E2=80=94=E2=80=94newcontest=E7=9A=84=E6=95=B4=E4=BD=93?= =?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/controllers/contests_controller.rb | 13 ++++++++++++- app/views/contests/show_attendingcontest.html.erb | 0 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 app/views/contests/show_attendingcontest.html.erb diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 830c74357..75778631a 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -292,7 +292,18 @@ class ContestsController < ApplicationController ###我要参赛 def show_attendingcontest - + + + + + ##引用base_newcontest整体样式 + respond_to do |format| + format.html { + render :layout => 'base_newcontest' + } + format.api + + end end ###end diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb new file mode 100644 index 000000000..e69de29bb From f2dbbc48fcff8cb17f981a241fc75a78663f64f4 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 8 May 2014 15:06:36 +0800 Subject: [PATCH 07/48] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=92=8C=E5=85=B3=E8=81=94=E4=BD=9C=E5=93=81=E9=83=BD=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=94=A8=E4=BA=86=EF=BC=8C=E5=8F=82=E8=B5=9B=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=B9=9F=E5=8F=AF=E4=BB=A5=E5=8F=96=E5=87=BA=E6=9D=A5?= =?UTF-8?q?=E4=BA=86=EF=BC=8C=E6=8E=A5=E4=B8=8B=E6=9D=A5=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=A5=E5=8E=BB=E5=8F=82=E8=B5=9B=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=92=8C=E5=8F=82=E8=B5=9B=E5=BA=94=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 19 ++- .../contests/show_attendingcontest.html.erb | 141 ++++++++++++++++++ lib/redmine.rb | 3 +- 3 files changed, 152 insertions(+), 11 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 75778631a..bb5b85a1a 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -292,17 +292,16 @@ class ContestsController < ApplicationController ###我要参赛 def show_attendingcontest - - - - + @softapplication = Softapplication.all + @contesting_softapplication = @contest.contesting_softapplications + @contesting_softapplication = paginateHelper @contesting_softapplication, 10 ##引用base_newcontest整体样式 - respond_to do |format| - format.html { - render :layout => 'base_newcontest' - } - format.api - + @contest = Contest.find_by_id(params[:id]) + respond_to do |format| + format.html { + render :layout => 'base_newcontest' + } + format.api end end diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index e69de29bb..993c63f28 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -0,0 +1,141 @@ + + + + + +
温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!
+<% if User.current.logged? %> + +
+
参赛步骤:
+
+ 步骤1: + <%= link_to '新建参赛作品', new_softapplication_path(:target=>'_blank'), :target=>'_blank' %> + (先点击“新建参赛作品”, 然后返回本页继续步骤2即可。) +
+
+ 步骤1: + <%= link_to '关联参赛作品', "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %> +
+
+ + + + +<% end %> + + + + +<% @contesting_softapplication.each do |c_softapplication|%> + <% if c_softapplication.softapplication %> +
+
+ + 应用软件: + + <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> + +
+
+
+ + 简介: + + <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> + +
+
+
+ + 发布时间: + + <%=format_time c_softapplication.created_at %> + + + +
+
+ <% end %> +
+<% end %> + + + + diff --git a/lib/redmine.rb b/lib/redmine.rb index 583497841..3d3565430 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -281,7 +281,8 @@ 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 :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attending_contest + 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' }, # :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p } end From 538f8516b0e4c556081969f3cce8ab608d1ebc87 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 8 May 2014 16:49:52 +0800 Subject: [PATCH 08/48] =?UTF-8?q?=E7=9B=AE=E5=89=8D=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E5=88=A4=E6=96=AD=E5=B0=86=E5=B1=9E=E4=BA=8E?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=9A=84=E9=A1=B9=E7=9B=AE=E6=88=96=E6=98=AF?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E6=98=BE=E7=A4=BA=E5=88=B0=E6=88=91=E8=A6=81?= =?UTF-8?q?=E5=8F=82=E8=B5=9B=E7=9A=84=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/contests_controller.rb | 46 +++++++- .../contests/show_attendingcontest.html.erb | 100 ++++++++++++------ 2 files changed, 113 insertions(+), 33 deletions(-) diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index bb5b85a1a..7e27d1171 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -253,6 +253,7 @@ class ContestsController < ApplicationController ############ ##显示参赛的应用 def show_softapplication + # @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) # @option = [] @@ -292,10 +293,53 @@ class ContestsController < ApplicationController ###我要参赛 def show_attendingcontest +##取出参赛项目 + @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) + @option = [] + # @contesting_project_count = @contesting_project_all.count + # @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page'] + @membership.each do |membership| + unless(membership.project.project_type==1) + membership.member_roles.each{|role| + if(role.role_id == 3) + @option << membership.project + end + } + end + end + @user = @contest.author + @contesting_project = @contest.contesting_projects.all + if params[:student_id].present? + @temp = [] + @contesting_project.each do |pro| + if pro.project && pro.project.project_status + if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id + @temp << pro + end + end + @temp + end + @contesting_project = @temp + else + + @temp = [] + @contesting_project.each do |pro| + if pro.project && pro.project.project_status + @temp << pro + end + @temp + end + if @temp.size > 0 + @contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} + end + end +##取出参赛应用 @softapplication = Softapplication.all @contesting_softapplication = @contest.contesting_softapplications @contesting_softapplication = paginateHelper @contesting_softapplication, 10 - ##引用base_newcontest整体样式 + + +##引用base_newcontest整体样式 @contest = Contest.find_by_id(params[:id]) respond_to do |format| format.html { diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 993c63f28..90f32affc 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -55,11 +55,11 @@ } - +
温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!
<% if User.current.logged? %> -
+
参赛步骤:
步骤1: @@ -100,41 +100,77 @@ <% end %> - + +<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %> -<% @contesting_softapplication.each do |c_softapplication|%> - <% if c_softapplication.softapplication %> -
-
- - 应用软件: - - <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> - -
+ <% @contesting_project.each do |c_project|%> + <% if c_project.project %> +
+
+ + 参赛作品: + + <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> + +
+
+
+ + 简介: + + <%= c_project.project.description.truncate(90, omission: '...') %> + +
+
+
+ + 发布时间: + + <%= format_time c_project.created_at%> + + + +
-
- - 简介: - - <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> - -
-
-
- - 发布时间: - - <%=format_time c_softapplication.created_at %> - - - -
-
+ <% end %> +
+ <% end %> +<% else %> + <% @contesting_softapplication.each do |c_softapplication|%> + <% if c_softapplication.softapplication %> +
+
+ + 参赛作品: + + <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> + +
+
+
+ + 简介: + + <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> + +
+
+
+ + 发布时间: + + <%=format_time c_softapplication.created_at %> + + + +
+
+ <% end %> +
<% end %> -
<% end %> + From d686e105a54e7b505d2ea7fb41bff68a7d417523 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 8 May 2014 17:10:17 +0800 Subject: [PATCH 09/48] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=85=B3=E8=81=94?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=A1=86=E6=98=BE=E7=A4=BA=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/contests/show_attendingcontest.html.erb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index 90f32affc..a3e238fa3 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -59,7 +59,7 @@
温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛!
<% if User.current.logged? %> -
+
参赛步骤:
步骤1: @@ -73,10 +73,10 @@
-