This commit is contained in:
daiao 2017-03-21 17:06:24 +08:00
parent 50f5c4a735
commit a3f0cc9b51
2 changed files with 72 additions and 13 deletions

View File

@ -2,6 +2,52 @@
<%= javascript_include_tag 'baiduTemplate', 'jquery.datetimepicker.js' %>
<% end %>
<div id="code_results">
<div class=" col-width fl content-history mt15" >
<div class="panel-header clearfix">
<h3 class="fl">测评历史</h3>
<div class="fr mt5">
<a href="#"><i class="fa fa-minus font-14 mr10 fl color-grey"></i></a>
<a href="#"><i class="fa fa-minus-square font-14 fl color-grey"></i></a>
</div>
</div>
<div class="content-history-inner">
<% unless @outputs.blank? %>
<% @outputs.each do |output| %>
<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>
<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>
<% end %>
<% end %>
</div>
</div>
<div class=" col-width fl content-output ml15 mt15">
<div class="panel-header ">
<h3 >测试输出</h3>
</div>
<div class="content-history-inner">
Thor position=(32,4).Light position={32,4}<br/>
Engryg=74
</div>
</div>
<div class=" col-width fl content-submit ml15 mt15">
<div class="panel-header ">
<h3 >操作</h3>
</div>
<div class="content-submitbox">
<a href="#" class="task-btn mb10 ">保存修改</a>
<% if @game.status == 0 %>
<div id="game_commit">
<%= link_to "提交评测", {:controller => 'games', :action => "game_build", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
</div>
<% elsif @game.status == 1 %>
<a class="task-btn mb10">评测中..</a>
<% elsif @game.status == 2 %>
<%= link_to "下 一 步", {:controller => 'games', :action => "next_step", :id => @game, :myshixun_id => @myshixun}, :class => "task-btn task-btn-green", :onclick => "training_task_submmit();", :remote => true %>
<% end %>
</div>
</div>
</div>
<script id="t:exec_results" type="text/html">
<div class="col-width fl mt15 content-half-fix undis" style="margin-top:125px;">
@ -59,7 +105,7 @@
</div>
<div class="content-submitbox">
<a href="javascript:void(0)" class="task-btn mb10" onclick="file_edit_submit()">保存修改</a>
<! if(status == 0){ !>
<! if( status == 0){ !>
<div id="game_commit">
<a href="javascript:void(0)" class="task-btn task-btn-green" onclick="training_task_submmit();">提交评测</a>
</div>
@ -73,14 +119,6 @@
</script>
<script >
var bt = baidu.template;
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
$(function(){
var html = bt('t:exec_results',{status: <%= @game.status %>});
$("#code_results").html(html);
});
function training_task_submmit(){
$.ajax({

View File

@ -3,7 +3,7 @@
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<form action="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/file_update?path=<%= @path %>" method="post" id="file_update_id" data-remote="true">
<li class="clearfix" xmlns="http://www.w3.org/1999/html">
<li class="clearfix" xmlns="http://www.w3.org/1999/html" style="height: 600px">
<textarea class = "" id="challenge-answer" name="content">
<%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %>
</textarea>
@ -27,7 +27,28 @@
// get value right from instance
$('#challenge-answer').val(cMirror.getValue());
});
var web_h = window.innerHeight;
$(document).ready(function(){
$(".CodeMirror-line").children('span:first').children().css("margin-left", "-60px")
if($.browser.msie) {
$(".CodeMirror").css("height", web_h * 0.61 + "px");
}
else if($.browser.safari)
{
$(".CodeMirror").css("height", web_h * 0.61 + "px");
}
else if($.browser.mozilla)
{
$(".CodeMirror").css("height", web_h * 0.595 + "px");
}
else if($.browser.opera) {
$(".CodeMirror").css("height", web_h * 0.61 + "px");
}else if($.browser.chrome){
if(window.navigator.userAgent.indexOf("MetaSr") == -1){
$(".CodeMirror").css("height", web_h * 0.61 + "px");
}else{
$(".CodeMirror").css("height", web_h * 0.58 + "px");
}
}
});
</script>