多选题插入与编辑页面加入限制样式

This commit is contained in:
Tim 2016-10-27 16:59:34 +08:00
parent df4bb86cdd
commit 8b2b6c2dfb
2 changed files with 25 additions and 1 deletions

View File

@ -33,6 +33,18 @@
</div>
<div class="ur_editor_content">
<ul id="poll_answers_<%=poll_question.id%>">
<li class='ur_item'>
<div class="fl mr30">
<label>下限<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<select class="poll-multiple-limit"></select>
<span>(可选)答题时最少选几项</span>
</div>
<div class="fl">
<label>上限<span class='ur_index'></span>&nbsp;&nbsp;&nbsp;</label>
<select class="poll-multiple-limit"></select>
<span>(可选)答题时最多选几项</span>
</div>
</li>
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<% if poll_answer.answer_text != '' %>
<li class='ur_item new_answer'>

View File

@ -170,6 +170,18 @@ function insert_MCQ(quest_type,quest_id){
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">' +
'<div class="fl mr30">' +
'<label>下限<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>' +
'<select class="poll-multiple-limit"></select>' +
'<span>(可选)答题时最少选几项</span>' +
'</div>' +
'<div class="fl">'+
'<label>上限<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>' +
'<select class="poll-multiple-limit"></select>' +
'<span>(可选)答题时最多选几项</span>' +
'</div>' +
'</li>' +
'<li class="ur_item">'+
'<label>选项<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
@ -477,7 +489,7 @@ function insert_MCQ(quest_type,quest_id){
multiLimit();
}
//多选题答题限制数实时更新
//多选题答题限制数实时更新
function multiLimit(){
var upperLimit = $(".questionContainer .new_answer").size();
$(".poll-multiple-limit").append("<option></option>");