From e904966b84cbdf0ca428e9fc11d09553ed3a9611 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 10:09:53 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E6=AF=8F=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E4=B8=80=E5=85=B3=EF=BC=8C=E5=AE=9E=E8=AE=AD=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=88=97=E8=A1=A8=E8=A6=81=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 12 +++++++++++- app/views/games/_pass_game_show.html.erb | 12 ++++++++++-- app/views/games/refresh_game_list.js.erb | 2 ++ app/views/games/show.js.erb | 1 + config/routes.rb | 1 + 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 app/views/games/refresh_game_list.js.erb diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b898b0474..e4ff7a64d 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -3,7 +3,7 @@ class GamesController < ApplicationController layout "base_myshixun" skip_before_filter :verify_authenticity_token, :only => [:file_update] before_filter :find_myshixun, :only => [:index] - before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status, :change_status, :answer, :minus_score] + before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status, :change_status, :answer, :minus_score, :refresh_game_list] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update] before_filter :allowd_manager before_filter :allowd_view, :only => [:show] @@ -303,6 +303,16 @@ class GamesController < ApplicationController end end + def refresh_game_list + myshixun_id = params[:myshixun_id] + @myshixun = Myshixun.find_by_identifier(myshixun_id) + @challenges = Challenge.where(:shixun_id => @myshixun.shixun_id) + + respond_to do |format| + format.js + end + end + private def test_set_static_data test_sets test_result = [] diff --git a/app/views/games/_pass_game_show.html.erb b/app/views/games/_pass_game_show.html.erb index dc9155ecb..717ecb2cc 100644 --- a/app/views/games/_pass_game_show.html.erb +++ b/app/views/games/_pass_game_show.html.erb @@ -2,7 +2,7 @@
\ No newline at end of file + + \ No newline at end of file diff --git a/app/views/games/refresh_game_list.js.erb b/app/views/games/refresh_game_list.js.erb new file mode 100644 index 000000000..ffb5e4d22 --- /dev/null +++ b/app/views/games/refresh_game_list.js.erb @@ -0,0 +1,2 @@ +$("#all_task_show").html("<%= j (render :partial => "games_list") %>"); +hideModal(); \ No newline at end of file diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index e11eaba6b..99d4bf53e 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -3,6 +3,7 @@ $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); $("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); $("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); + $("#all_task_show").html("<%= j (render :partial => "games_list") %>"); $("#all_task_show").hide(); fadein = 0; <% else %> diff --git a/config/routes.rb b/config/routes.rb index e4d97c22d..aea2ea1cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -89,6 +89,7 @@ RedmineApp::Application.routes.draw do get 'file_edit' get 'answer' get 'minus_score' + get 'refresh_game_list' end end end From b659d6180e48db20ebe9152f9af4abb969ca4fa3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 May 2017 14:21:53 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=9C=A8=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/base_course_community.html.erb | 147 +++++++++--------- 1 file changed, 76 insertions(+), 71 deletions(-) diff --git a/app/views/layouts/base_course_community.html.erb b/app/views/layouts/base_course_community.html.erb index 273390463..48666f9da 100644 --- a/app/views/layouts/base_course_community.html.erb +++ b/app/views/layouts/base_course_community.html.erb @@ -30,89 +30,93 @@ -