2015-01-16 10:11:17 +08:00
|
|
|
|
<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<!--编辑单选start-->
|
2015-01-17 11:58:19 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
function resetQuestion<%=poll_question.id%>()
|
|
|
|
|
{
|
2016-10-14 14:50:51 +08:00
|
|
|
|
// $("#poll_questions_title_<%#=poll_question.id%>").val("<%#= poll_question.question_title%>")
|
2015-01-17 11:58:19 +08:00
|
|
|
|
$("#is_necessary_<%=poll_question.id%>").replaceWith("<input type='checkbox' name='is_necessary' id='is_necessary_<%=poll_question.id%>' value='true' <%= poll_question.is_necessary == 1 ? 'checked' : ''%>/>");
|
2016-10-12 13:34:09 +08:00
|
|
|
|
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %> " +
|
|
|
|
|
"<% if poll_answer.answer_text != '' %>" +
|
|
|
|
|
"<li class='ur_item new_answer'>" +
|
2015-03-24 16:56:39 +08:00
|
|
|
|
"<label>选项<span class='ur_index'></span>: </label>" +
|
2016-10-12 13:34:09 +08:00
|
|
|
|
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value='<%= poll_answer.answer_text%>'/>" +
|
2015-01-17 11:58:19 +08:00
|
|
|
|
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
|
|
|
|
"</li>" +
|
|
|
|
|
"<div class='cl'></div>" +
|
2016-10-12 13:34:09 +08:00
|
|
|
|
"<% else %>"+
|
|
|
|
|
"<li class='ur_item new_answer other_answer'>" +
|
|
|
|
|
"<label>其它<span class='ur_index'></span>: </label>" +
|
|
|
|
|
"<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'/>" +
|
|
|
|
|
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
|
|
|
|
"</li>" +
|
|
|
|
|
"<div class='cl'></div>" +
|
|
|
|
|
"<% end %>"+
|
2015-01-17 11:58:19 +08:00
|
|
|
|
"<% end%>");
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2016-10-11 08:51:00 +08:00
|
|
|
|
<div class="questionEditContainer">
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<div class="ur_editor_title">
|
2016-10-14 14:50:51 +08:00
|
|
|
|
<label class="questionLabel mt8">问题: </label>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
2016-10-14 14:50:51 +08:00
|
|
|
|
<textarea maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题题目" onfocus="autoHeight('#poll_questions_title_<%=poll_question.id%>',30)"><%= poll_question.question_title%></textarea>
|
2015-01-17 11:58:19 +08:00
|
|
|
|
<input type="checkbox" name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<label>必答</label>
|
2015-01-14 14:23:41 +08:00
|
|
|
|
</div>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<div class="ur_editor_content">
|
2015-01-17 11:58:19 +08:00
|
|
|
|
<ul id="poll_answers_<%=poll_question.id%>">
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
|
2016-10-11 08:51:00 +08:00
|
|
|
|
<% if poll_answer.answer_text != '' %>
|
|
|
|
|
<li class='ur_item new_answer'>
|
|
|
|
|
<label>选项<span class='ur_index'></span>: </label>
|
2016-10-12 13:34:09 +08:00
|
|
|
|
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
|
2016-10-11 08:51:00 +08:00
|
|
|
|
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
|
|
|
|
|
</li>
|
|
|
|
|
<div class='cl'></div>
|
|
|
|
|
<% else %>
|
|
|
|
|
<li class="ur_item new_answer other_answer">
|
|
|
|
|
<label>其它<span class="ur_index"></span>: </label>
|
2016-10-12 13:34:09 +08:00
|
|
|
|
<input placeholder='由参加问卷的人输入内容' name='question_other_answer' readonly='readonly' class='disabled' type='text'>
|
2016-10-11 08:51:00 +08:00
|
|
|
|
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
<% end %>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<% end%>
|
|
|
|
|
</ul>
|
2016-10-11 08:51:00 +08:00
|
|
|
|
<ul>
|
|
|
|
|
<li class="ur_item">
|
|
|
|
|
<div class="dash-block new-question" onclick='add_single_answer($(this));'>新建选项</div>
|
|
|
|
|
</li>
|
|
|
|
|
<div class='cl'></div>
|
|
|
|
|
<li class="ur_item">
|
|
|
|
|
<a href="javascript:void(0);" class="ml50 fontGrey2" onclick='add_other_answer($(this))'>添加[其他]选项</a>
|
|
|
|
|
</li>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</ul>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="ur_editor_footer">
|
2016-10-12 13:34:09 +08:00
|
|
|
|
<a data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);" class="grey_btn fr borderRadius" ><%= l(:button_cancel)%></a>
|
|
|
|
|
<a data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);" class="blue_btn fr borderRadius mr5" ><%= l(:label_button_ok)%></a>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
2015-01-13 18:21:46 +08:00
|
|
|
|
</div>
|
2015-01-15 18:17:45 +08:00
|
|
|
|
<!--编辑单选 end-->
|
2015-01-14 14:23:41 +08:00
|
|
|
|
<% end%>
|