challenge编辑
This commit is contained in:
parent
ebc7ee4ee5
commit
0a8f1936f7
|
@ -69,7 +69,6 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@outputs = GameOutputs.all
|
||||
@challenge_samples = @challenge.challenge_samples
|
||||
@test_sets = @challenge.test_sets
|
||||
@challenge_tags = @challenge.challenge_tags
|
||||
|
@ -80,7 +79,9 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
|
||||
@challenge_samples = @challenge.challenge_samples
|
||||
@test_sets = @challenge.test_sets
|
||||
@challenge_tags = @challenge.challenge_tags
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
@ -22,7 +22,7 @@ class MyshixunsController < ApplicationController
|
|||
game.update_attribute(:status, 0)
|
||||
end
|
||||
game_outputs = GameOutputs.create(:code => status, :msg => message, :game_id => task_id, :out_put => outPut)
|
||||
render :json => {:data => "sucess"}
|
||||
render :json => {:data => "success"}
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</li>
|
||||
<li class="clearfix">
|
||||
<% if params[:action] == "edit" && @challenge.challenge_samples.count > 0 %>
|
||||
<% @challenge.challenge_samples.each_with_index do |sample, index| %>
|
||||
<% @challenge.challenge_samples.each_with_index do |sample, index| %>
|
||||
<label class="panel-form-label fl">样例设置:</label>
|
||||
<ul class="fl task-bg-grey">
|
||||
<li class="clearfix">
|
||||
|
@ -60,7 +60,7 @@
|
|||
<input type="text" class="panel-form-width-670 panel-form-height-30" name="sample[output][]" id="textarea_sample_output_test" placeholder="样例输出" value="<%= sample.output %>" />
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<label class="panel-form-label fl">样例设置:</label>
|
||||
<ul class="fl task-bg-grey">
|
||||
|
@ -77,14 +77,15 @@
|
|||
<% end %>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<% if params[:action] == "edit" && @challenge.test_sets.count > 0 %>
|
||||
<% @challenge.test_sets.each_with_index do |test, index| %>
|
||||
<label class="panel-form-label fl">测试集设置:</label>
|
||||
<ul class="fl task-bg-grey">
|
||||
<li class="clearfix">
|
||||
<label class="panel-form-label fl">测试集设置:</label>
|
||||
<ul class="fl task-bg-grey">
|
||||
<li class="clearfix">
|
||||
|
||||
<% if params[:action] == "edit" && @challenge.test_sets.count > 0 %>
|
||||
<% @challenge.test_sets.each_with_index do |test, index| %>
|
||||
<p class="clearfix">
|
||||
<span class="color-green fb fl" name="inputs_label">测试<%= index + 1 %></span>
|
||||
<% if index == 0%>
|
||||
<% if index == 0 %>
|
||||
<span class="color-grey fr" style="font-size:12px;">温馨提示:在学员"提交评测"时进行自动检测。</span>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" title="增加" class="test_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt12"></i></a>
|
||||
|
@ -94,13 +95,9 @@
|
|||
</p>
|
||||
<input type="text" class="panel-form-width-670 panel-form-height-30 mb10" name="program[input][]" id="textarea_input_test" value="<%= test.input %>"/>
|
||||
<input type="text" class="panel-form-width-670 panel-form-height-30" name="program[output][]" id="textarea_output_test" value="<%= test.output %>" />
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<label class="panel-form-label fl">测试集设置:</label>
|
||||
<ul class="fl task-bg-grey">
|
||||
<li class="clearfix">
|
||||
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="clearfix">
|
||||
<span class="color-green fb fl" name="inputs_label">测试1</span>
|
||||
<span class="color-grey fr" style="font-size:12px;">温馨提示:在学员"提交评测"时进行自动检测。</span>
|
||||
|
@ -108,9 +105,9 @@
|
|||
</p>
|
||||
<input type="text" class="panel-form-width-670 panel-form-height-30 mb10" name="program[input][]" id="textarea_input_test" placeholder="测试输入" />
|
||||
<input type="text" class="panel-form-width-670 panel-form-height-30" name="program[output][]" id="textarea_output_test" placeholder="测试输出" />
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<label class=" panel-form-label fl"> 知识/技能点:</label>
|
||||
|
@ -118,7 +115,13 @@
|
|||
<button class="close fl mt3 mr10" type="button" onclick="$('#add_shixun_skill').slideToggle();" id="add_knowledge">+</button>
|
||||
<div class="task-tag tag-grey mb10 mr10 fl undis" id="add_shixun_skill">
|
||||
<button data-dismiss="alert" class="close fr mt3 ml5" type="button" onclick="$('#add_shixun_skill').slideToggle();">×</button>
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" placeholder="请输入知识/技能点" />
|
||||
<% if params[:action] == "edit" && @challenge_tags.count > 0 %>
|
||||
<% @challenge_tags.each do |tag| %>
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" placeholder="请输入知识/技能点" value="<%= tag.try(:name) %>" />
|
||||
<% end %>
|
||||
<% else %>
|
||||
<input type="text" class="task-tag-input" onblur="add_tag();" placeholder="请输入知识/技能点" />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -137,7 +140,11 @@
|
|||
<span style="display: none" class="c_red ml90" id="new_shixun_score">分值设定不能为空</span>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr10" onclick="challenge_create()">保存</a>
|
||||
<% if params[:action] == "edit" %>
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr10" onclick="challenge_update()">保存</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr10" onclick="challenge_create()">保存</a>
|
||||
<% end %>
|
||||
<a href="javascript:void(0)" class="task-btn fr mr10">取消</a>
|
||||
</li>
|
||||
</div>
|
||||
|
@ -263,4 +270,16 @@
|
|||
$('#new_challenge').submit();
|
||||
}
|
||||
}
|
||||
|
||||
function challenge_update(){
|
||||
if($('#challenge_subject').val().trim() == ""){
|
||||
$("#new_shixun_name").show();
|
||||
}else if($("#challenge_task_pass").val().trim() == ""){
|
||||
$("#new_shixun_pass").show();
|
||||
}else if($("#challenge_score").val().trim()==""){
|
||||
$("#new_shixun_score").show();
|
||||
}else{
|
||||
$('#edit_challenge_48').submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -102,34 +102,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<% if false %>
|
||||
<div class="mt10 mb10" id ="issue_show_total">
|
||||
<div class="banner-big f16 fontGrey3">
|
||||
任务详情
|
||||
<a href="<%= new_shixun_challenge_path(@shixun) %>" class="sy_btn_green fr" >新建</a>
|
||||
</div>
|
||||
|
||||
<div class="container-big mt10" style="float:left;">
|
||||
<div class="pro_page_box">
|
||||
<div class="problem_main borderBottomNone">
|
||||
<div id="issue_detail_show">
|
||||
<%= @challenge.subject %>
|
||||
</div>
|
||||
<div>
|
||||
<%= link_to "提交评测", {:controller => 'challenges', :action => "challenge_build", :id => @challenge, :shixun_id => @shixun}, :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();", :remote => true %>
|
||||
</div>
|
||||
</div>
|
||||
<% unless @outputs.nil? %>
|
||||
<% @outputs.each do |output| %>
|
||||
<%= output %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<!--problem_main end-->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue