This commit is contained in:
cxt 2016-10-12 13:34:09 +08:00
parent 405e2cfb9b
commit 399b982e0d
16 changed files with 344 additions and 241 deletions

View File

@ -5,14 +5,22 @@
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#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' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
$("#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'>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value='<%= poll_answer.answer_text%>'/>" +
"<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>&nbsp;&nbsp;&nbsp;</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 %>"+
"<% end%>");
}
</script>
@ -31,14 +39,14 @@
<% if poll_answer.answer_text != '' %>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
<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>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="由参加问卷的人输入内容" name='question_other_answer' readonly="readonly" class="disabled" type="text">
<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>
@ -57,12 +65,8 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<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>
</div>
<div class="cl"></div>
</div>

View File

@ -5,44 +5,66 @@
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#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' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item'>" +
"<% if poll_answer.answer_text != '' %>" +
"<li class='ur_item new_answer'>" +
"<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
"<input type='text' maxlength='200' name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value='<%= poll_answer.answer_text%>'/>" +
"<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>&nbsp;&nbsp;&nbsp;</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 %>"+
"<% end%>");
}
</script>
<div class="ur_editor checkbox">
<div class="questionEditContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多选题题" value="<%= poll_question.question_title%>"/>
<input maxlength="250" class="questionTitle w570" 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" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.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>
<% if poll_answer.answer_text != '' %>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='输入选项内容' value="<%= poll_answer.answer_text%>"/>
<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>&nbsp;&nbsp;&nbsp;</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 %>
<% end%>
</ul>
<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>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<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>
</div>
<div class="cl"></div>
</div><!--编辑多选 end-->

View File

@ -2,30 +2,53 @@
<script type="text/javascript">
function resetQuestion<%=poll_question.id%>()
{
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>")
$("#poll_questions_title_<%=poll_question.id%>").val("<%= poll_question.question_title%>");
$("#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' : ''%>/>");
$("#poll_answers_<%=poll_question.id%>").html("<% poll_question.poll_answers.reorder('answer_position').each do |poll_answer| %>" +
"<li class='ur_item new_answer'>" +
"<label class='ml50'>问题<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>" +
"<input type='text' maxlength='200' class='w520' name='question_answer[<%= poll_answer.id %>]' placeholder='请输入主观题分题的问题' value='<%= poll_answer.answer_text%>'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
"</li>" +
"<div class='cl'></div>" +
"<% end%>");
}
</script>
<div class="ur_editor textarea"> <!--编辑多行文字start-->
<div class="questionEditContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" 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" id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label>
<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观题的问题描述" value="<%= poll_question.question_title%>"/>
<label>
<input id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" type="checkbox" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
必答
</label>
</div>
<div class="ur_editor_toolbar">
<!--<label>尺寸:</label>-->
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item new_answer'>
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type='text' class="w520" maxlength="200" name='question_answer[<%= poll_answer.id %>]' placeholder='请输入主观题分题的问题' value="<%= poll_answer.answer_text%>"/>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li>
<div class='cl'></div>
<% end%>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-subjective w520" onclick="add_multi_question($(this))">新建选项</div>
</li>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑多行文字end-->

View File

@ -6,22 +6,19 @@
$("#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' : ''%>/>");
}
</script>
<div class="ur_editor text "> <!--编辑单行文字start-->
<div class="questionEditContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="ur_question_title" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" id="is_necessary_<%=poll_question.id%>" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label>
<input maxlength="250" id="poll_questions_title_<%=poll_question.id%>" class="questionTitle w570" contenteditable="true" type="text"
name="poll_questions_title" placeholder="请输入单行主观题" value="<%= poll_question.question_title%>"/>
<label>
<input name="is_necessary" id="is_necessary_<%=poll_question.id%>" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%> type="checkbox">
必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">
<%= l(:button_cancel)%>
</a>
<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>
</div>
<div class="cl"></div>
</div><!--编辑单行文字end-->

View File

@ -10,7 +10,7 @@
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul id="que_ul">
<ul>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'/>
@ -45,12 +45,12 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div>

View File

@ -1,44 +1,51 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%><!--新建多选start-->
<div class="ur_editor checkbox">
<div class="questionContainer">
<div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="2"/>
<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题"/>
<input maxlength="250" class="questionTitle W600" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
</div>
<div class="ur_editor_content">
<ul>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<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>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<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>
<li class='ur_item'>
<li class='ur_item new_answer'>
<label>选项<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<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>
</ul>
<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>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div>

View File

@ -1,24 +1,44 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="ur_editor textarea"> <!--编辑多行文字start-->
<div class="questionContainer"> <!--编辑多行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="4"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label>必答</label>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答
</label>
</div>
<div class="ur_editor_toolbar">
<div class="ur_editor_content">
<ul>
<li class="ur_item new_answer">
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="请输入主观题分题的问题" style="width:520px;" type="text" name="question_answer[0]">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input placeholder="请输入主观题分题的问题" style="width:520px;" type="text" name="question_answer[1]">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>
<div class="cl"></div>
</ul>
<ul>
<li class="ur_item">
<div class="dash-block new-subjective" onclick='add_multi_question($(this));'>新建选项</div>
</li>
<div class="cl"></div>
</ul>
<!--<label>尺寸:</label>-->
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑多行文字end-->

View File

@ -1,19 +1,21 @@
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
<div class="ur_editor text "> <!--编辑单行文字start-->
<div class="questionContainer"> <!--编辑单行文字start-->
<div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="3"/>
<input maxlength="250" id="poll_questions_title_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>
<input type="checkbox" name="is_necessary" value="true" checked/>
<label for="ur_question_require">必答</label>
<input maxlength="250" id="poll_questions_title_new" class="questionTitle W600" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>
<label>
<input name="is_necessary" value="true" checked type="checkbox">
必答
</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
<%= l(:button_cancel)%>
</a>
<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question_new">
<%= l(:label_button_ok)%>
</a>
</div>
<div class="cl"></div>
</div><!--编辑单行文字end-->

View File

@ -41,7 +41,7 @@
</div>
<% end %>
</div>
<div class="testStatus" id="single_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多行主观题</h3>
<% multi_question_list.each do |poll_question| %>
<div id="poll_questions_<%= poll_question.id%>">

View File

@ -58,48 +58,55 @@ function add_MC(){
function insert_MC(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
' <div class="ur_editor radio"> '+
' <div class="questionEditContainer"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入单选题题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<li class="ur_item new_answer">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'<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>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
@ -119,13 +126,13 @@ function add_MCQ(){
function insert_MCQ(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor checkbox">'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input maxlength="250" class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题"/>'+
'<input maxlength="250" class="questionTitle w570" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'</div>'+
@ -133,34 +140,41 @@ function insert_MCQ(quest_type,quest_num,quest_id){
'<ul>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除"" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="新建选项"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'<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>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
@ -180,23 +194,23 @@ function insert_MCQ(quest_type,quest_num,quest_id){
function insert_SINGLE(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor text ">'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label for="ur_question_require">必答</label>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
@ -215,25 +229,44 @@ function insert_MCQ(quest_type,quest_num,quest_id){
function insert_MULIT(quest_type,quest_num,quest_id){
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
'<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>'+
'<div class="ur_editor textarea">'+
'<div class="questionEditContainer">'+
'<div class="ur_editor_title">'+
'<label for="ur_question_title">问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="4"/>'+
'<input maxlength="250" id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题"/>'+
'<input type="checkbox" name="is_necessary" value="true" checked/>'+
'<label>必答</label>'+
'<input maxlength="250" id="poll_questions_title" class="questionTitle w570" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行主观题的问题描述"/>'+
'<label><input type="checkbox" name="is_necessary" value="true" checked/>'+
'必答</label>'+
'</div>'+
'<div class="ur_editor_toolbar">'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item new_answer">'+
'<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input placeholder="请输入主观题分题的问题" class="w520" type="text" name="question_answer[0]">'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item new_answer">'+
'<label class="ml50">问题<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input placeholder="请输入主观题分题的问题" class="w520" type="text" name="question_answer[1]">'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a> </li>'+
'<div class="cl"></div>'+
'</ul>'+
'<ul>'+
'<li class="ur_item">'+
'<div class="dash-block new-subjective w520" onclick="add_multi_question($(this))">新建选项</div>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="grey_btn fr borderRadius" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'<a class="blue_btn fr borderRadius mr5" data-button="ok" id="add_new_question">'+
'<%= l(:label_button_ok)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
@ -320,6 +353,13 @@ function insert_MCQ(quest_type,quest_num,quest_id){
$("#edit_poll_questions_"+question_id).show();
$("#poll_questions_title_"+question_id).focus();
}
//多行主观增加分题
function add_multi_question(doc)
{
doc.parent().parent().prev().append("<li class='ur_item new_answer'><label class='ml50'>问题<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label><input maxlength='200' style='width:520px;' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='请输入主观题分题的问题'/>" +
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
"</li><div class='cl'></div>");
}
//单选题
function add_single_answer(doc)
{
@ -340,7 +380,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
{
if(doc.parent().siblings("li.new_answer").length == 0)
{
alert("选择题至少有一个选项");
alert("至少有一个选项");
}
else
{
@ -426,14 +466,23 @@ function insert_MCQ(quest_type,quest_num,quest_id){
<div id="new_poll_question_new">
</div>
<div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();">
<%= l(:label_memo_create)%>
</a>
<div class="polls_cha">
<input id="show_result" type="checkbox" checked name="show_result" value="1" >
<label for="">允许学生查看调查结果</label>
</div>
<!--<div class="ur_buttons">-->
<!--<a class="ur_button_submit" onclick="poll_submit();">-->
<!--<%= l(:label_memo_create)%>-->
<!--</a>-->
<!--<div class="polls_cha">-->
<!--<input id="show_result" type="checkbox" checked name="show_result" value="1" >-->
<!--<label for="">允许学生查看调查结果</label>-->
<!--</div>-->
<!--</div>-->
<div class="tac">
<input name="show_result" value="1" type="checkbox" checked id="show_result">
<label for="">允许学生查看调查结果</label>
</div>
<div>
<a href="javascript:void(0);" class="grey_btn fr borderRadius">取消</a>
<a href="javascript:void(0);" class="blue_btn fr borderRadius mr5">保存</a>
<a href="javascript:void(0);" onclick="poll_submit();" class="blue_btn fr borderRadius mr5" >发布</a>
</div>
<div class="cl"></div>
<!-- 新增问题 -->

View File

@ -13,7 +13,7 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=poll_question.id%>" onclick="chooseQuestionType('mc',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=poll_question.id%>" onclick="dismiss('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table" style="width:675px;">
@ -28,7 +28,7 @@
</label>
<% else %>
<label>
<input class="ur_radio" name="<%= poll_question %>" value="" type="checkbox">
<input class="ur_radio" name="<%= poll_question %>" value="" type="radio">
</label>
<input placeholder="其它" readonly="readonly" class="disabled questionnaire-input w300" type="text">
<% end %>
@ -42,11 +42,3 @@
<!-- 新增问题 -->
<div id="insert_new_poll_question_mc_<%=poll_question.id%>">
</div>
<div id="div_mc_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MCQ('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_SINGLE('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mc',<%=poll_question.id%>);insert_MULIT('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,10 +1,7 @@
<div class="ur_question_item checkbox ur_editor02">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[多选题]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
@ -12,18 +9,25 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=poll_question.id%>" onclick="chooseQuestionType('mcq',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=poll_question.id%>" onclick="dismiss('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<table class="ur_table">
<div class="ur_inputs" style="width:675px;">
<table class="ur_table" style="width:675px;">
<tbody>
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<tr>
<td>
<label>
<input class="ur_radio" type="checkbox" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% if poll_answer.answer_text != '' %>
<label>
<input class="ur_radio" type="checkbox" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
<%= poll_answer.answer_text%>
</label>
<% else %>
<label>
<input class="ur_radio" name="<%= poll_question %>" value="" type="checkbox">
</label>
<input placeholder="其它" readonly="readonly" class="disabled questionnaire-input w300" type="text">
<% end %>
</td>
</tr>
<% end %>
@ -33,12 +37,4 @@
</div><!--多选题显示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=poll_question.id%>">
</div>
<div id="div_mcq_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MC('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_SINGLE('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%=poll_question.id%>);insert_MULIT('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,33 +1,23 @@
<div class="ur_question_item textarea ur_editor02">
<div class="ur_preview">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<%= poll_question.question_title %>
<span class="title_index">[多行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mulit_<%=poll_question.id%>" onclick="chooseQuestionType('mulit',<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
</div>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
</div>
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_mulit_<%=poll_question.id%>" onclick="dismiss('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
<div class="ml40 mb10">
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
<input type="text" class="questionnaire-input" name="<%= poll_question %>" style="width:652px;" />
</div>
<% end %>
</div><!--多行展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_mulit_<%=poll_question.id%>">
</div>
<div id="div_mulit_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,10 +1,7 @@
<div class="ur_question_item text ur_editor02 ">
<div class="ur_title">
<span class="title_index">
第<%= poll_question.question_number%>题:
</span>
<div>
<div class="testEditTitle">
第<%= poll_question.question_number%>题:
<%= poll_question.question_title %>
<span class="title_index">[单行主观]</span>
<%if poll_question.is_necessary == 1%>
<span class="ur_required" title="必答">*</span>
<%end%>
@ -12,20 +9,12 @@
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=poll_question.id%>" onclick="chooseQuestionType('single',<%=poll_question.id%>);"></a>
<a class='ur_icon_add' title='向下插入' id="add_single_<%=poll_question.id%>" onclick="dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
<div class="cl"></div>
<div class="ur_inputs">
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
<input class="questionnaire-input" type="text" size="" maxlength="" value="" style="width:692px;">
</div>
</div><!--单行文字展示 end-->
<!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=poll_question.id%>">
</div>
<div id="div_single_<%=poll_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MC('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MCQ('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
<li><a href="javascript:void(0);" onclick=" dismiss('single',<%=poll_question.id%>);insert_MULIT('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
</ul>
</div>

View File

@ -1,30 +1,42 @@
<% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
<% else %>
$("#new_poll_question_new").html("");
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<% if @poll_questions.question_type == 1%>" +
$("#new_poll_question_new").html("");
<%if @poll_questions.question_type == 1%>
$("#mc_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 2%>" +
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 3%>" +
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 4%>" +
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"<% end%>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<% if @poll_questions.question_type == 1%>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 2%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 2%>
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 3%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 3%>
$("#single_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_questions}) %>" +
"<% elsif @poll_questions.question_type == 4%>" +
"</div>" +
"</div>");
<%elsif @poll_questions.question_type == 4%>
$("#multi_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"</div>" +
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_questions}) %>" +
"<% end%>" +
"</div>" +
"</div>");
"</div>" +
"</div>");
<% end %>
<% end %>

View File

@ -260,7 +260,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w460{ width:460px;}
.w465{width:465px !important;}
.w490{width:490px;}
.w520{ width:520px;}
.w520{ width:520px !important;}
.w543{ width:543px;}
.w557{ width:557px;}
.w570 {width:570px !important;}
@ -469,7 +469,7 @@ a:hover.grey_n_btn{ background:#717171; color:#fff;}
a.green_btn{background:#28be6c;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a:hover.green_btn{ background:#14ad5a;}
.blue_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;}
a.blue_btn{background:#64bdd9;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a.blue_btn{background:#3b94d6;color:#fff; font-weight:normal; padding:2px 10px; text-align:center;}
a:hover.blue_btn{ background:#329cbd;}
.red_btn{ background:red; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;}
a.red_btn{background:red; color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;}