From a80eeeb5ab12680fa1447211fe3ccdc5339867f3 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 23 Mar 2017 10:56:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 9 ++++++--- app/views/games/_exec_results.html.erb | 14 +++++++------- .../games/_myshixun_extend_repository.html.erb | 2 +- app/views/games/_myshixun_repository.html.erb | 2 +- app/views/games/file_edit.js.erb | 2 ++ app/views/games/outputs_show.js.erb | 1 + 6 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 app/views/games/outputs_show.js.erb diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5bb87c42b..a86791930 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -2,7 +2,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, :output_show, :file_edit, :file_update, :game_status] + before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :game_status] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update] before_filter :allowd_manager, :only => [:game_build] include ApplicationHelper @@ -57,8 +57,11 @@ class GamesController < ApplicationController # json调用,显示左边的隐藏具体详情@game 字段 msg # 刷新右边的输出结果 @game out_put - def output_show - @game = GameOutputs.find(params[:game_output_id]) + def outputs_show + @game = Output.find(params[:game_output_id]) + respond_to do |format| + format.js + end end # status 0: 未提交测评或者提交测评失败后报错;1:中间状态还没返回值;2:返回值并成功 diff --git a/app/views/games/_exec_results.html.erb b/app/views/games/_exec_results.html.erb index 4459ad114..00d8ec84b 100644 --- a/app/views/games/_exec_results.html.erb +++ b/app/views/games/_exec_results.html.erb @@ -13,9 +13,9 @@ </div> <div class="content-history-inner" style="height: 100px;"> <% unless @outputs.blank? %> - <% @outputs.each do |output| %> + <% @outputs.each_with_index do |output, index| %> <div class="<%= output.code == 0 ? 'clearfix history-success mb10' : 'clearfix history-fail mb10' %>"> - <span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>">2</span> + <span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>"><%= index + 1 %></span> <p class="fl"><%= output.code == 0 ? '恭喜,您已经完成了本任务!' : '错误结果!' %></p> <%= link_to "详情", outputs_show_myshixun_game_path(@game, :myshixun_id => @myshixun, :game_output_id => output.id), :class => "fr mr10" %> </div> @@ -32,21 +32,21 @@ </div> <div class="content-history-inner"> <% unless @outputs.blank? %> - <% @outputs.each do |output| %> + <% @outputs.each_with_index do |output, index| %> <div class="<%= output.code == 0 ? 'clearfix history-success mb10' : 'clearfix history-fail mb10' %>"> - <span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>">2</span> + <span class="<%= output.code == 0 ? 'icon-success fl mr5' : 'icon-fail fl mr5' %>"><%= index + 1%></span> <p class="fl"><%= output.code == 0 ? '恭喜,您已经完成了本任务!' : '错误结果!' %></p> - <%= link_to "详情", outputs_show_myshixun_game_path(@game, :myshixun_id => @myshixun, :game_output_id => output.id), :class => "fr mr10" %> + <%= link_to "详情", outputs_show_myshixun_game_path(@game, :myshixun_id => @myshixun, :game_output_id => output.id), :class => "fr mr10", :remote => true %> </div> <% end %> <% end %> </div> </div> <div class="col-width fl content-output ml15 mt15"> - <div class="panel-header "> + <div class="panel-header"> <h3 >测试输出</h3> </div> - <div class="content-history-inner"> + <div class="content-history-inner" id="game_test_output"> <%= @game.outputs.first.try(:out_put) %> </div> </div> diff --git a/app/views/games/_myshixun_extend_repository.html.erb b/app/views/games/_myshixun_extend_repository.html.erb index 41dee3c6f..84a876b94 100644 --- a/app/views/games/_myshixun_extend_repository.html.erb +++ b/app/views/games/_myshixun_extend_repository.html.erb @@ -2,7 +2,7 @@ <h3 class="fl"><%= render :partial => 'myshixun_breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %></h3> <div class="fr mt5"> <% if params[:action] == "entry" %> - <a href="javascript:void(0)" class="fl task-btn mb10 mr10" style="display: none" id="sava_edit_btn" onclick="file_edit_submit()">保存修改</a> + <a href="javascript:void(0)" class="undis" id="sava_edit_btn" onclick="file_edit_submit()" title="保存修改"><i class="fa fa-save font-18 fl color-grey mr10"></i></a> <a href="<%= file_edit_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => params[:path]) %>" data-remote="true" ><i class="fa fa-edit font-18 fl color-grey mr10"></i></a> <% end %> <a href="javascript:void(0)" onclick="close_big_repository()"><i class="fa fa-compress font-14 fl color-grey"></i></a> diff --git a/app/views/games/_myshixun_repository.html.erb b/app/views/games/_myshixun_repository.html.erb index 4a33a881f..25655cd93 100644 --- a/app/views/games/_myshixun_repository.html.erb +++ b/app/views/games/_myshixun_repository.html.erb @@ -4,7 +4,7 @@ </h3> <div class="fr mt5"> <% if params[:action] == "entry" %> - <a href="javascript:void(0)" class="fl task-btn mb10 mr10" style="display: none" id="sava_edit_btn" onclick="file_edit_submit()">保存修改</a> + <a href="javascript:void(0)" class="undis" id="sava_edit_btn1" onclick="file_edit_submit()" title="保存修改"><i class="fa fa-save font-18 fl color-grey mr10"></i></a> <a href="<%= file_edit_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => params[:path]) %>" data-remote="true" ><i class="fa fa-edit font-18 fl color-grey mr10"></i></a> <% end %> <a href="javascript:void(0)" onclick="extend_repository();"><i class="fa fa-expand font-18 fl color-grey"></i></a> diff --git a/app/views/games/file_edit.js.erb b/app/views/games/file_edit.js.erb index be9105b98..3e915ca02 100644 --- a/app/views/games/file_edit.js.erb +++ b/app/views/games/file_edit.js.erb @@ -1,2 +1,4 @@ $("#file_entry_content").html('<%= escape_javascript(render :partial => 'games/file_edit_form') %>'); +$("#file_entry_content_inner").html('<%= escape_javascript(render :partial => 'games/file_edit_form') %>'); +$("#sava_edit_btn1").show(); $("#sava_edit_btn").show(); \ No newline at end of file diff --git a/app/views/games/outputs_show.js.erb b/app/views/games/outputs_show.js.erb new file mode 100644 index 000000000..08dba256e --- /dev/null +++ b/app/views/games/outputs_show.js.erb @@ -0,0 +1 @@ +$("#game_test_output").html("<%= @game.msg %>"); \ No newline at end of file