新建测验题目、问卷题目防止多次提交表单
This commit is contained in:
parent
3e340b6ef9
commit
bc39b68bb2
|
@ -87,10 +87,19 @@
|
||||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||||
if(title.length == 0 || score.length == 0){
|
if(title.length == 0 || score.length == 0){
|
||||||
alert("题目标题/分数不能为空");
|
alert("题目标题/分数不能为空");
|
||||||
|
doc.one('click', function(){
|
||||||
|
add_poll_question($(this),quest_type);
|
||||||
|
});
|
||||||
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
||||||
alert("分数必须是非零开头的数字");
|
alert("分数必须是非零开头的数字");
|
||||||
|
doc.one('click', function(){
|
||||||
|
add_poll_question($(this),quest_type);
|
||||||
|
});
|
||||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||||
alert("标准答案不能为空");
|
alert("标准答案不能为空");
|
||||||
|
doc.one('click', function(){
|
||||||
|
add_poll_question($(this),quest_type);
|
||||||
|
});
|
||||||
}else{
|
}else{
|
||||||
doc.parent().parent().parent().submit();}
|
doc.parent().parent().parent().submit();}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -54,9 +54,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),2);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -42,9 +42,16 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);"> 保存 </a>
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -90,7 +90,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -102,6 +102,9 @@
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -101,6 +101,9 @@
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),2);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'保存'+
|
'保存'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -77,6 +77,9 @@
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this),3);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
<input type="hidden" name="question_type" value="1"/>
|
<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="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入单选题标题"/>
|
||||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||||
<label>必答</label>
|
<label>必答</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
|
||||||
<%= l(:label_button_ok)%>
|
<%= l(:label_button_ok)%>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
||||||
|
@ -46,3 +46,10 @@
|
||||||
</div>
|
</div>
|
||||||
<!--编辑单选 end-->
|
<!--编辑单选 end-->
|
||||||
<% end%>
|
<% end%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question_new").one('click', function(){
|
||||||
|
add_poll_question_new($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
<input type="hidden" name="question_type" value="2"/>
|
<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="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_new" placeholder="请输入多选题标题"/>
|
||||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||||
<label>必答</label>
|
<label>必答</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
|
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question_new">
|
||||||
<%= l(:label_button_ok)%>
|
<%= l(:label_button_ok)%>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
||||||
|
@ -43,3 +43,10 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end%><!--编辑多选 end-->
|
<% end%><!--编辑多选 end-->
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question_new").one('click', function(){
|
||||||
|
add_poll_question_new($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label for="ur_question_title">问题: </label>
|
<label for="ur_question_title">问题: </label>
|
||||||
<input type="hidden" name="question_type" value="4"/>
|
<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 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/>
|
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||||
<label>必答</label>
|
<label>必答</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
|
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
|
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
|
||||||
<%= l(:label_button_ok)%>
|
<%= l(:label_button_ok)%>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
||||||
|
@ -23,3 +23,10 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div><!--编辑多行文字end-->
|
</div><!--编辑多行文字end-->
|
||||||
<% end%>
|
<% end%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question_new").one('click', function(){
|
||||||
|
add_poll_question_new($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -3,12 +3,12 @@
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label for="ur_question_title">问题: </label>
|
<label for="ur_question_title">问题: </label>
|
||||||
<input type="hidden" name="question_type" value="3"/>
|
<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_new" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行主观标题"/>
|
||||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||||
<label for="ur_question_require">必答</label>
|
<label for="ur_question_require">必答</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_editor_footer">
|
<div class="ur_editor_footer">
|
||||||
<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">
|
<a class="btn_submit c_white" data-button="ok" id="add_new_question_new">
|
||||||
<%= l(:label_button_ok)%>
|
<%= l(:label_button_ok)%>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">
|
||||||
|
@ -18,3 +18,10 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div><!--编辑单行文字end-->
|
</div><!--编辑单行文字end-->
|
||||||
<% end%>
|
<% end%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#add_new_question_new").one('click', function(){
|
||||||
|
add_poll_question_new($(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -51,8 +51,8 @@ function chooseQuestionType(quest_type,quest_id){
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_MC(){
|
function add_MC(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title_new").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_MC(quest_type,quest_num,quest_id){
|
function insert_MC(quest_type,quest_num,quest_id){
|
||||||
|
@ -94,7 +94,7 @@ function add_MC(){
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'<%= l(:label_button_ok)%>'+
|
'<%= l(:label_button_ok)%>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -106,11 +106,14 @@ function add_MC(){
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_MCQ(){
|
function add_MCQ(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
|
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title_new").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_MCQ(quest_type,quest_num,quest_id){
|
function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
|
@ -152,7 +155,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'</ul>'+
|
'</ul>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'<%= l(:label_button_ok)%>'+
|
'<%= l(:label_button_ok)%>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -164,11 +167,14 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_single(){
|
function add_single(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
|
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_single') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title_new").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_SINGLE(quest_type,quest_num,quest_id){
|
function insert_SINGLE(quest_type,quest_num,quest_id){
|
||||||
|
@ -185,7 +191,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'<label for="ur_question_require">必答</label>'+
|
'<label for="ur_question_require">必答</label>'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'<%= l(:label_button_ok)%>'+
|
'<%= l(:label_button_ok)%>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -197,10 +203,13 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function add_mulit(){
|
function add_mulit(){
|
||||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
|
$("#new_poll_question_new").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title_new").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_MULIT(quest_type,quest_num,quest_id){
|
function insert_MULIT(quest_type,quest_num,quest_id){
|
||||||
|
@ -219,7 +228,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'<div class="ur_editor_toolbar">'+
|
'<div class="ur_editor_toolbar">'+
|
||||||
'</div>'+
|
'</div>'+
|
||||||
'<div class="ur_editor_footer">'+
|
'<div class="ur_editor_footer">'+
|
||||||
'<a class="btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
'<a class="btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||||
'<%= l(:label_button_ok)%>'+
|
'<%= l(:label_button_ok)%>'+
|
||||||
'</a>'+
|
'</a>'+
|
||||||
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
'<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||||
|
@ -231,6 +240,9 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
'<% end%>'
|
'<% end%>'
|
||||||
);
|
);
|
||||||
$("#poll_questions_title").focus();
|
$("#poll_questions_title").focus();
|
||||||
|
$("#add_new_question").one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择导入调查问卷
|
//选择导入调查问卷
|
||||||
|
@ -262,7 +274,27 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
function add_poll_question(doc)
|
function add_poll_question(doc)
|
||||||
{
|
{
|
||||||
var title = $.trim($("#poll_questions_title").val());
|
var title = $.trim($("#poll_questions_title").val());
|
||||||
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
|
if(title.length == 0){
|
||||||
|
alert("标题不能为空");
|
||||||
|
doc.one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
doc.parent().parent().parent().submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_poll_question_new(doc)
|
||||||
|
{
|
||||||
|
var title = $.trim($("#poll_questions_title_new").val());
|
||||||
|
if(title.length == 0){
|
||||||
|
alert("标题不能为空");
|
||||||
|
doc.one('click', function(){
|
||||||
|
add_poll_question($(this));
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
doc.parent().parent().parent().submit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//修改标题时确定按钮
|
//修改标题时确定按钮
|
||||||
function edit_poll_question(doc,id)
|
function edit_poll_question(doc,id)
|
||||||
|
@ -373,7 +405,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){
|
||||||
</div><!--选项 end-->
|
</div><!--选项 end-->
|
||||||
|
|
||||||
<!-- 新增问题 -->
|
<!-- 新增问题 -->
|
||||||
<div id="new_poll_question">
|
<div id="new_poll_question_new">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ur_buttons">
|
<div class="ur_buttons">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<% if @is_insert %>
|
<% 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 %>
|
<% else %>
|
||||||
$("#new_poll_question").html("");
|
$("#new_poll_question_new").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 %>'>" +
|
||||||
|
|
Loading…
Reference in New Issue