编辑单选题时页面js添加

This commit is contained in:
sw 2015-01-15 16:44:35 +08:00
parent 4edd9fee64
commit f78de71814
3 changed files with 15 additions and 5 deletions

View File

@ -5,13 +5,13 @@
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input class="ur_question_title" type="text" name="poll_questions_title" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/>
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" name="is_necessary" value="true" checked = "<%= poll_question.is_necessary == 1%>"/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul>
<% poll_question.poll_answers.reorder("answer_position") do |poll_answer| %>
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
@ -24,7 +24,7 @@
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().parent().submit();">确定</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="pollQuestionCancel(<%= poll_question.id%>);">取消</a>
</div>
<div class="cl"></div>
</div>

View File

@ -26,6 +26,16 @@
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
//
function pollQuestionCancel(question_id){
$("#show_poll_questions_"+question_id).show();
$("#edit_poll_questions_"+question_id).hide();
}
function pollQuestionEdit(question_id){
$("#show_poll_questions_"+question_id).hide();
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
}
//单选题
function add_single_answer(doc)
{

View File

@ -9,8 +9,8 @@
<%end%>
</div>
<a href="#" class="ur_icon_de" title="删除"></a>
<a href="#" class="ur_icon_edit" title="编辑"></a>
<a class="ur_icon_de" title="删除" onclick=""></a>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" >