样式调整
This commit is contained in:
parent
28f7390595
commit
368fc339c0
|
@ -0,0 +1,63 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[0]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -0,0 +1,58 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>候选答案<span class='ur_index'></span>: </label>" +
|
||||
"<input name='exercise_choice[<%=index %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>候选答案<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[<%=index %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -1,22 +1,65 @@
|
|||
<% exercise.exercise_questions.each do |exercise_question|%>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">单选题</h3>
|
||||
<% mc_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<% if exercise_question.question_type == 1%>
|
||||
<%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
<% elsif exercise_question.question_type == 2%>
|
||||
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
<% elsif exercise_question.question_type == 3%>
|
||||
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<% if exercise_question.question_type == 1%>
|
||||
<%= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
<% elsif exercise_question.question_type == 2%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">多选题</h3>
|
||||
<% mcq_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
<% elsif exercise_question.question_type == 3%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">填空题</h3>
|
||||
<% single_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%# exercise.exercise_questions.each do |exercise_question|%>
|
||||
<!-- <div id="poll_questions_<%#= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%#= exercise_question.id %>">
|
||||
<%# if exercise_question.question_type == 1%>
|
||||
|
||||
<%#= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# elsif exercise_question.question_type == 2%>
|
||||
<%#= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# elsif exercise_question.question_type == 3%>
|
||||
<%#= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# end%>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%#= exercise_question.id %>" style="display: none;">
|
||||
<%# if exercise_question.question_type == 1%>
|
||||
<%#= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# elsif exercise_question.question_type == 2%>
|
||||
<%#= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# elsif exercise_question.question_type == 3%>
|
||||
<%#= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
|
||||
<%# end%>
|
||||
</div>
|
||||
</div>-->
|
||||
<%# end %>
|
|
@ -335,7 +335,7 @@
|
|||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>">目前试卷总分:<span class="c_red" id="current_score"><%=current_score %>分</span></div>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>" id="current_score_div">目前试卷总分:<span class="c_red" id="current_score"><%=current_score %>分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=exercise_question.id%>" onclick="chooseQuestionType('mc',<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" >
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=exercise_question.id%>" onclick="chooseQuestionType('mcq',<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
<a class='ur_icon_add' title='向下插入' id="add_single_<%=exercise_question.id%>" onclick="chooseQuestionType('single',<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.choice_text%><br />
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,27 +1,57 @@
|
|||
<% if @is_insert %>
|
||||
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
|
||||
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
|
||||
<% else %>
|
||||
$("#new_poll_question").html("");
|
||||
|
||||
$("#poll_content").append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
$("#new_poll_question").html("");
|
||||
<%if @exercise_questions.question_type == 1%>
|
||||
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<% if @exercise_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<% if @exercise_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
<%if @exercise_questions.question_type == 2%>
|
||||
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
<%if @exercise_questions.question_type == 3%>
|
||||
$("#single_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
/*$("#poll_content").append("<div id='poll_questions_<%#= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%#= @exercise_questions.id %>'>" +
|
||||
"<%# if @exercise_questions.question_type == 1%>" +
|
||||
"<%#= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%#= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%#= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%#= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%# if @exercise_questions.question_type == 1%>" +
|
||||
"<%#= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# elsif @exercise_questions.question_type == 2%>" +
|
||||
"<%#= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# elsif @exercise_questions.question_type == 3%>" +
|
||||
"<%#= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"<%# end%>" +
|
||||
"</div>" +
|
||||
"</div>");*/
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
$("#current_score_div").show();
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
$("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questions_<%= @exercise_question.id %>'>" +
|
||||
"<% if @exercise_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_question.id %>' style='display: none;'>" +
|
||||
"<% if @exercise_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>");
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
Loading…
Reference in New Issue