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

70 lines
5.6 KiB
Plaintext
Raw Normal View History

2015-11-26 10:56:24 +08:00
<%= 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%>()
{
2017-02-17 09:03:43 +08:00
$("#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 %>'/>" +
2015-11-26 10:56:24 +08:00
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
2017-02-17 09:03:43 +08:00
"<% 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>");
2015-11-26 10:56:24 +08:00
}
</script>
<div class="questionContainer" style="width: 680px;">
2017-02-17 09:03:43 +08:00
<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>
2015-11-26 10:56:24 +08:00
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
2015-11-26 10:56:24 +08:00
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
2017-02-17 09:03:43 +08:00
<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>
2015-11-26 10:56:24 +08:00
</div>
2017-02-17 09:03:43 +08:00
2015-11-26 10:56:24 +08:00
<div class="ur_editor_content">
<ul>
<div id="poll_answers_<%=exercise_question.id%>">
2017-02-17 09:03:43 +08:00
<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) %>"/>
2015-11-26 10:56:24 +08:00
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
2017-02-17 09:03:43 +08:00
<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 %>">
2015-11-26 10:56:24 +08:00
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<% end %>
2017-02-17 09:03:43 +08:00
<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>
2015-11-26 10:56:24 +08:00
</div>
</ul>
</div>
<div class="ur_editor_footer">
2017-02-17 09:03:43 +08:00
<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);">
2015-11-26 10:56:24 +08:00
保存
</a>
2017-02-17 09:03:43 +08:00
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
2015-11-26 10:56:24 +08:00
<%= l(:button_cancel)%>
</a>
</div>
<div class="cl"></div>
</div>
<!--编辑单选 end-->
2015-11-18 20:14:19 +08:00
<% end%>