在发布问卷的时候中间可以插入问题
This commit is contained in:
parent
ebfa2f6749
commit
45d5972a93
|
@ -137,11 +137,19 @@ class PollController < ApplicationController
|
||||||
@poll_questions.poll_answers.new question_option
|
@poll_questions.poll_answers.new question_option
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if @poll_questions.save
|
# 如果是插入的话,那么从插入的这个id以后的question_num都将要+1
|
||||||
respond_to do |format|
|
if params[:quest_id]
|
||||||
format.js
|
@is_insert = true
|
||||||
end
|
@poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1")
|
||||||
|
@poll_question_num = params[:quest_num].to_i
|
||||||
|
@poll_questions.question_number = params[:quest_num].to_i + 1
|
||||||
end
|
end
|
||||||
|
if @poll_questions.save
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#修改题目
|
#修改题目
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
||||||
<!--新建单选start-->
|
<!--新建单选start-->
|
||||||
|
<% insert_begin = insert_begin %>
|
||||||
<div class="ur_editor radio">
|
<div class="ur_editor radio">
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
|
|
|
@ -6,23 +6,203 @@ function edit_head(){
|
||||||
$("#polls_description").val($("#polls_description_div").html());
|
$("#polls_description").val($("#polls_description_div").html());
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_MC(){
|
function chooseQuestionType(quest_type,quest_id){
|
||||||
|
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
|
||||||
|
|
||||||
|
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
|
||||||
|
|
||||||
|
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
|
||||||
|
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
|
||||||
|
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_MC(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
}
|
}
|
||||||
function add_MCQ(){
|
|
||||||
|
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="ur_editor_title"> '+
|
||||||
|
'<label>问题: </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 type="checkbox" name="is_necessary" value="true" checked/>'+
|
||||||
|
'<label>必答</label>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_content">'+
|
||||||
|
'<ul>'+
|
||||||
|
'<li class="ur_item">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_footer">'+
|
||||||
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||||
|
'<%= l(:label_button_ok)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
'<%= l(:button_cancel)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="cl"></div>'+
|
||||||
|
'</div>'+
|
||||||
|
'<% end%>'
|
||||||
|
);
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_MCQ(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
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="ur_editor_title">'+
|
||||||
|
'<label>问题: </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 type="checkbox" name="is_necessary" value="true" checked/>'+
|
||||||
|
'<label>必答</label>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_content">'+
|
||||||
|
'<ul>'+
|
||||||
|
'<li class="ur_item">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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">'+
|
||||||
|
'<label>选项<span class="ur_index"></span>: </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>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_footer">'+
|
||||||
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||||
|
'<%= l(:label_button_ok)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
'<%= l(:button_cancel)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="cl"></div>'+
|
||||||
|
'</div>'+
|
||||||
|
'<% end%>'
|
||||||
|
);
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_single(){
|
function add_single(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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="ur_editor_title">'+
|
||||||
|
'<label for="ur_question_title">问题: </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 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" onclick="add_poll_question($(this));">'+
|
||||||
|
'<%= l(:label_button_ok)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
'<%= l(:button_cancel)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="cl"></div>'+
|
||||||
|
'</div>'+
|
||||||
|
'<% end%>'
|
||||||
|
);
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
function add_mulit(){
|
function add_mulit(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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="ur_editor_title">'+
|
||||||
|
'<label for="ur_question_title">问题: </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>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_toolbar">'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="ur_editor_footer">'+
|
||||||
|
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||||
|
'<%= l(:label_button_ok)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
'<%= l(:button_cancel)%>'+
|
||||||
|
'</a>'+
|
||||||
|
'</div>'+
|
||||||
|
'<div class="cl"></div>'+
|
||||||
|
'</div>'+
|
||||||
|
'<% end%>'
|
||||||
|
);
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
|
||||||
//添加标题时确定按钮
|
//添加标题时确定按钮
|
||||||
function add_poll_question(doc)
|
function add_poll_question(doc)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
<div class="ur_question_item radio ur_editor02">
|
<div class="ur_question_item radio ur_editor02">
|
||||||
<div class="ur_title">
|
<div class="ur_title">
|
||||||
<span class="title_index">
|
<span class="title_index">
|
||||||
|
@ -9,9 +12,11 @@
|
||||||
<span class="ur_required" title="必答">*</span>
|
<span class="ur_required" title="必答">*</span>
|
||||||
<%end%>
|
<%end%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
<%= 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") %>
|
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_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>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="ur_inputs">
|
<div class="ur_inputs">
|
||||||
<table class="ur_table" >
|
<table class="ur_table" >
|
||||||
|
@ -29,4 +34,15 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div><!--单选题显示 end-->
|
</div><!--单选题显示 end-->
|
||||||
|
<!-- 新增问题 -->
|
||||||
|
<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=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MC('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MCQ('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_SINGLE('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mc',<%=poll_question.id%>);insert_MULIT('mc',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -12,6 +12,7 @@
|
||||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
<%= 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") %>
|
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_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>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="ur_inputs">
|
<div class="ur_inputs">
|
||||||
<table class="ur_table">
|
<table class="ur_table">
|
||||||
|
@ -29,4 +30,15 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div><!--多选题显示 end-->
|
</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=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MC('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MCQ('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_SINGLE('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mcq',<%=poll_question.id%>);insert_MULIT('mcq',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -13,9 +13,21 @@
|
||||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
<%= 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") %>
|
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_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="cl"></div>
|
||||||
<div class="ur_inputs">
|
<div class="ur_inputs">
|
||||||
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
|
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</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=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -12,8 +12,20 @@
|
||||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
<%= 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") %>
|
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_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>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="ur_inputs">
|
<div class="ur_inputs">
|
||||||
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
|
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
|
||||||
</div>
|
</div>
|
||||||
</div><!--单行文字展示 end-->
|
</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=" chooseQuestionType('single',<%=poll_question.id%>);insert_MC('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_MCQ('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">单行主观</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" chooseQuestionType('single',<%=poll_question.id%>);insert_MULIT('single',<%=poll_question.question_number%>,<%=poll_question.id%>);">多行主观</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
|
@ -1,4 +1,8 @@
|
||||||
|
<% if @is_insert %>
|
||||||
|
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
|
||||||
|
<% else %>
|
||||||
$("#new_poll_question").html("");
|
$("#new_poll_question").html("");
|
||||||
|
|
||||||
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||||
"<% if @poll_questions.question_type == 1%>" +
|
"<% if @poll_questions.question_type == 1%>" +
|
||||||
|
@ -23,4 +27,4 @@ $("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||||
"<% end%>" +
|
"<% end%>" +
|
||||||
"</div>" +
|
"</div>" +
|
||||||
"</div>");
|
"</div>");
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -28,7 +28,7 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
|
||||||
#polls div{word-break: break-all;word-wrap: break-word;}
|
#polls div{word-break: break-all;word-wrap: break-word;}
|
||||||
.ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; }
|
.ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; }
|
||||||
.ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;}
|
.ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;}
|
||||||
.ur_title{ padding:20px 0px ; float:left; width:604px; }
|
.ur_title{ padding:20px 0px ; float:left; width:564px; }
|
||||||
.ur_required{ font-weight: bold; color:red;}
|
.ur_required{ font-weight: bold; color:red;}
|
||||||
.ur_inputs{ color:#666;}
|
.ur_inputs{ color:#666;}
|
||||||
.ur_table{border-top:1px solid #dcdcdc; background:#fff;}
|
.ur_table{border-top:1px solid #dcdcdc; background:#fff;}
|
||||||
|
@ -101,10 +101,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
|
||||||
.ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;}
|
.ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;}
|
||||||
a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
|
a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
|
||||||
a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;}
|
a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;}
|
||||||
|
|
||||||
a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;}
|
a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;}
|
||||||
a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;}
|
a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;}
|
||||||
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
|
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
|
||||||
a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
||||||
|
.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
|
||||||
|
a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||||
|
|
||||||
/***弹框***/
|
/***弹框***/
|
||||||
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
||||||
|
|
Loading…
Reference in New Issue