socialforge/app/views/exercise/_edit_MCQ.html.erb

70 lines
5.6 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%= 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_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>");
$("#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("<input style='display: none;' name='exercise_choice' id='exercise_choice_<%=exercise_question.id%>' value='<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>'/>" +
"<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
"<li class='ur_item new_answer'>" +
"<a class='<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn' title='设为答案' href='javascript:void(0)' onclick='toggle_select($(this), 2, <%= exercise_question.id %>);'><%=convert_to_char (index+1).to_s %></a>" +
"<input maxlength='200' class='w600' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% end%>" +
"<li class='ur_item'>" +
"<a class='question_choice_dash fl mr10 choice_btn'><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>" +
"<div class='dash-block new-question w600' onclick='add_single_answer($(this), 2);'>新建选项</div>" +
"</li> <div class='cl'></div>");
}
</script>
<div class="questionContainer" style="width: 680px;">
<div class="mb10 ur_item">
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
<textarea name="question_title" style="width: 625px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题的题干" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div id="poll_answers_<%=exercise_question.id%>">
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
<li class="ur_item new_answer">
<a class="<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, <%= exercise_question.id %>);"><%=convert_to_char (index+1).to_s %></a>
<input maxlength="200" class="w600" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn"><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
</li>
<div class="cl"></div>
</div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
保存
</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
</div>
<!--编辑单选 end-->
<% end%>