实训单选多选题TPM优化
This commit is contained in:
parent
ab3cfc69bd
commit
a67f4ca0f7
|
|
@ -131,7 +131,7 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
@index = params[:position].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -164,6 +164,7 @@ class ChallengesController < ApplicationController
|
|||
end
|
||||
end
|
||||
@challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first
|
||||
@index = params[:index].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -179,6 +180,7 @@ class ChallengesController < ApplicationController
|
|||
@challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first
|
||||
@category = @challenge_choose.category
|
||||
@position = @challenge_choose.position.to_i
|
||||
@index = params[:index].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -186,7 +188,7 @@ class ChallengesController < ApplicationController
|
|||
|
||||
def choose_type_show
|
||||
@challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first
|
||||
|
||||
@index = params[:index].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<li class="fl <%= @index.nil? ? "check_nav" : "" %>">
|
||||
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" class="color-black">本关任务</a>
|
||||
</li>
|
||||
<% @challenge.challenge_chooses.each_with_index do |choose, index| %>
|
||||
<li class="fl <%= @index == index ? "check_nav" : "" %>">
|
||||
<a href="<%= choose_type_show_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => choose.id, :index => index) %>" class="color-black" data-remote="true">
|
||||
<%= (index + 1).to_s + (choose.category == 1 ? ".单选题" : ".多选题") %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
@ -1,15 +1,8 @@
|
|||
<div class="stage-part-2 mt20">
|
||||
<div class="stage-part-2 mt20" id="">
|
||||
<ul class="nav_check_item border-bottom-orange clearfix">
|
||||
<li class="fl check_nav">
|
||||
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" class="color-black">本关任务</a>
|
||||
</li>
|
||||
<% @challenge.challenge_chooses.each_with_index do |choose, index| %>
|
||||
<li class="fl">
|
||||
<a href="<%= choose_type_show_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => choose.id) %>" class="color-black" data-remote="true">
|
||||
<%= (index + 1).to_s + (choose.category == 1 ? ".单选题" : ".多选题") %>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<div id="challenge_choose_tab">
|
||||
<%= render :partial => "challenges/choose_tab" %>
|
||||
</div>
|
||||
<a href="javascript:void(0)" class="fr white-btn green-btn white_bg addoption-btn">+ 多选题</a>
|
||||
<a href="javascript:void(0)" class="fr mr10 white-btn green-btn white_bg addoption-btn">+ 单选题</a>
|
||||
</ul>
|
||||
|
|
@ -41,7 +34,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="set_content" class="task-pm-box mh550 user_bg_shadow undis">
|
||||
<div id="set_content" class="task-pm-box mh550 user_bg_shadow undis">
|
||||
<%#= render :partial => "single_or_multiple_question" %>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -149,17 +149,6 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<script>
|
||||
/* //参考答案的编辑器
|
||||
editormd.loadKaTeX(function() {
|
||||
var answerMD = editormd.markdownToHTML("tpm_answer_show", {
|
||||
htmlDecode: "style,script,iframe", // you can filter tags decode
|
||||
taskList: true,
|
||||
tex: true, // 默认不解析
|
||||
flowChart: true, // 默认不解析
|
||||
sequenceDiagram: true // 默认不解析
|
||||
});
|
||||
});*/
|
||||
|
||||
subject_editormd = editormd("challenge_choose_subject", {
|
||||
width : "89.6%",
|
||||
height : 400,
|
||||
|
|
@ -458,7 +447,7 @@
|
|||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id)) %>",
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id), :index => @position ) %>",
|
||||
data: $("#challenge_choose_update").serialize(),
|
||||
type: 'POST',
|
||||
dataType: "script",
|
||||
|
|
@ -486,7 +475,7 @@
|
|||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id)) %>",
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id), :index => @position) %>",
|
||||
data: $("#challenge_choose_update").serialize(),
|
||||
type: 'POST',
|
||||
dataType: "script",
|
||||
|
|
@ -507,7 +496,7 @@
|
|||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id)) %>",
|
||||
url: "<%= update_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.try(:id), :index => @position) %>",
|
||||
data: $("#challenge_choose_update").serialize(),
|
||||
type: 'POST',
|
||||
dataType: "script",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<div class="white_bg">
|
||||
<div class="panel-form">
|
||||
<li class="clearfix pr30">
|
||||
<a href="<%= edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id) %>" data-remote="true" class="task-btn task-btn-green fr">编辑</a>
|
||||
<a href="<%= edit_choose_question_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id, :index => @index) %>" data-remote="true" class="task-btn task-btn-green fr">编辑</a>
|
||||
<a href="<%= destroy_challenge_choose_shixun_challenge_path(@challenge, :shixun_id => @shixun, :choose_id => @challenge_choose.id) %>" data-method="delete" class="task-btn fr mr10 deloption-btn">删除</a>
|
||||
</li>
|
||||
<li class="clearfix">
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>");
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "choose_type" %>
|
||||
<%= render :partial => "choose_type" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="save-tip">
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
$("#task_content").html("<%= j(render :partial => "single_or_multiple_question") %>");
|
||||
$("#task_content").html("<%= j(render :partial => "single_or_multiple_question") %>");
|
||||
$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>");
|
||||
|
|
@ -1 +1,2 @@
|
|||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>");
|
||||
|
|
@ -1 +1,2 @@
|
|||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#task_content").html("<%= j(render :partial => 'single_or_multiple_question_show')%>");
|
||||
$("#challenge_choose_tab").html("<%= j(render :partial => "challenges/choose_tab") %>");
|
||||
Loading…
Reference in New Issue