实训任务

This commit is contained in:
daiao 2017-03-23 16:51:32 +08:00
parent 4c50c708c2
commit e4985ce3bd
5 changed files with 32 additions and 15 deletions

View File

@ -12,15 +12,21 @@
</div>
</div>
<div class="content-history-inner" style="height: 100px;">
<% 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 %>
<! for(var i=0;i< results.length; i++) { !>
<! if(results[i][0] == 0){ !>
<div class="clearfix history-success mb10">
<span class="icon-success fl mr5"><!= i+1 !></span>
<p class="fl">恭喜,您已经完成了本任务!</p>
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true">详情</a>
</div>
<! }else{ !>
<div class="clearfix history-fail mb10">
<span class="icon-fail fl mr5"><!= i+1 !></span>
<p class="fl">错误结果!</p>
<a href="/myshixuns/<%= @myshixun.id %>/games/<%= @game.id %>/outputs_show?game_output_id=<!= results[i][1] !>" class="fr mr10" data-remote="true" >详情</a>
</div>
<! } !>
<! } !>
</div>
</div>
<div class="col-width fl content-history mt15" >
@ -64,7 +70,6 @@
<h3 >操作</h3>
</div>
<div class="content-submitbox">
<a href="javascript:void(0)" class="task-btn mb10" onclick="file_edit_submit()">保存修改</a>
<! if(status == 0){ !>
<div id="game_commit">
<a href="javascript:void(0)" class="task-btn task-btn-green" onclick="training_task_submmit();">提交评测</a>

View File

@ -3,8 +3,8 @@
<%= 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" style="height: 600px">
<textarea class = "" id="challenge-answer" name="content">
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
<textarea class = "" id="challenge-answer" name="content" style="height: 98%;width: 98%">
<%= Redmine::CodesetUtil.replace_invalid_utf8(@content) %>
</textarea>
<script>
@ -31,22 +31,34 @@
$(document).ready(function(){
if($.browser.msie) {
$(".CodeMirror").css("height", web_h * 0.61 + "px");
$("#edit_code_contents").css("height", web_h * 0.61 + "px");
$("#challenge-answer").css("height", web_h * 0.61 + "px");
}
else if($.browser.safari)
{
$(".CodeMirror").css("height", web_h * 0.61 + "px");
$("#edit_code_contents").css("height", web_h * 0.61 + "px");
$("#challenge-answer").css("height", web_h * 0.61 + "px");
}
else if($.browser.mozilla)
{
$(".CodeMirror").css("height", web_h * 0.595 + "px");
$("#edit_code_contents").css("height", web_h * 0.595 + "px");
$("#challenge-answer").css("height", web_h * 0.595 + "px");
}
else if($.browser.opera) {
$(".CodeMirror").css("height", web_h * 0.61 + "px");
$("#edit_code_contents").css("height", web_h * 0.61 + "px");
$("#challenge-answer").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");
$("#edit_code_contents").css("height", web_h * 0.61 + "px");
$("#challenge-answer").css("height", web_h * 0.61 + "px");
}else{
$(".CodeMirror").css("height", web_h * 0.58 + "px");
$("#edit_code_contents").css("height", web_h * 0.58 + "px");
$("#challenge-answer").css("height", web_h * 0.58 + "px");
}
}
});

View File

@ -1,4 +1,4 @@
$("#file_entry_content").html('<%= escape_javascript(render :partial => 'games/file_edit_form') %>');
$("#file_entry_content").replaceWith('<%= escape_javascript(render :partial => 'games/file_edit_form') %>');
$("#file_entry_content_inner").html('<%= escape_javascript(render :partial => 'games/extend_file_edit_form') %>');
$("#sava_edit_btn1").show();
$("#sava_edit_btn").show();

View File

@ -5891,7 +5891,7 @@
};
};
textarea.style.display = "none";
textarea.style.display = "none";
var cm = CodeMirror(function(node) {
textarea.parentNode.insertBefore(node, textarea.nextSibling);
}, options);

View File

@ -113,7 +113,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:245px; margin-top
.undis {display:none;}
.dis {display:block;}
.tab-info{ }
.content-editor-inner{ overflow:auto;}
.content-editor-inner{ overflow:hidden;}
.tab-info-inner{ overflow:auto; margin:15px 0 0px 15px; }
.big-tab-info-inner{ overflow:auto; margin:15px 0 0px 15px; }
.content-history-inner{overflow:auto; padding:15px; height: 80px}