实训任务

This commit is contained in:
daiao 2017-03-23 10:56:00 +08:00
parent 6f00a89cfa
commit a80eeeb5ab
6 changed files with 18 additions and 12 deletions

View File

@ -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返回值并成功

View File

@ -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,11 +32,11 @@
</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 %>
@ -46,7 +46,7 @@
<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>

View File

@ -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>

View File

@ -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>

View File

@ -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();

View File

@ -0,0 +1 @@
$("#game_test_output").html("<%= @game.msg %>");