增加限制:问卷标题最多100字,问卷描述最多300字,问卷问题最多250字,问卷选项最多200字

This commit is contained in:
sw 2015-01-17 11:05:38 +08:00
parent f99d159ca1
commit e14deeb4dd
10 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label> <label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/> <input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/> <input 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" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/> <input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label> <label>必答</label>
</div> </div>
@ -13,7 +13,7 @@
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> <% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' 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_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>

View File

@ -2,7 +2,7 @@
<div class="ur_editor checkbox"> <div class="ur_editor checkbox">
<div class="ur_editor_title"> <div class="ur_editor_title">
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/> <input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/> <input 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" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/> <input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label>必答</label> <label>必答</label>
</div> </div>
@ -11,7 +11,7 @@
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> <% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/> <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_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>

View File

@ -1,10 +1,10 @@
<%= form_for @poll,:remote => true do |f|%> <%= form_for @poll,:remote => true do |f|%>
<div class="ur_editor ur_title_editor"> <!--编辑头部start--> <div class="ur_editor ur_title_editor"> <!--编辑头部start-->
<div class="ur_title_editor_title"> <div class="ur_title_editor_title">
<input type="text" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/> <input type="text" maxlength="100" name="polls_name" id="polls_title" value="<%= @poll.polls_name %>" class="input_title" placeholder="问卷标题"/>
</div> </div>
<div class="ur_title_editor_prefix"> <div class="ur_title_editor_prefix">
<textarea name="polls_description" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea> <textarea name="polls_description" maxlength="300" id="polls_description" class="textarea_editor"><%= @poll.polls_description%></textarea>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a> <a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label> <label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/> <input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行主观标题" value="<%= poll_question.question_title%>"/> <input 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" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/> <input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label> <label for="ur_question_require">必答</label>
</div> </div>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label> <label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/> <input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
<input id="poll_questions_title_<%=poll_question.id%>" class="ur_question_title" contenteditable="true" type="text" <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%>"/> name="poll_questions_title" placeholder="请输入单行主观标题" value="<%= poll_question.question_title%>"/>
<input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/> <input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
<label for="ur_question_require">必答</label> <label for="ur_question_require">必答</label>

View File

@ -4,7 +4,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label> <label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="1"/> <input type="hidden" name="question_type" value="1"/>
<input 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" 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>
@ -12,21 +12,21 @@
<ul> <ul>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[0]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>
<div class='cl'></div> <div class='cl'></div>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[1]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>
<div class='cl'></div> <div class='cl'></div>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[2]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label>问题:&nbsp;&nbsp;</label> <label>问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="2"/> <input type="hidden" name="question_type" value="2"/>
<input 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" 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>
@ -11,21 +11,21 @@
<ul> <ul>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[0]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[0]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>
<div class='cl'></div> <div class='cl'></div>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[1]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[1]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>
<div class='cl'></div> <div class='cl'></div>
<li class='ur_item'> <li class='ur_item'>
<label>选项<span class='ur_index'></span></label> <label>选项<span class='ur_index'></span></label>
<input type='text' name='question_answer[2]' placeholder='新建选项'/> <input maxlength="200" type='text' name='question_answer[2]' placeholder='新建选项'/>
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a> <a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a> <a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
</li> </li>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label> <label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="4"/> <input type="hidden" name="question_type" value="4"/>
<input 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="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>

View File

@ -3,7 +3,7 @@
<div class="ur_editor_title"> <div class="ur_editor_title">
<label for="ur_question_title">问题:&nbsp;&nbsp;</label> <label for="ur_question_title">问题:&nbsp;&nbsp;</label>
<input type="hidden" name="question_type" value="3"/> <input type="hidden" name="question_type" value="3"/>
<input 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="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>

View File

@ -39,7 +39,7 @@
//单选题 //单选题
function add_single_answer(doc) function add_single_answer(doc)
{ {
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span></label><input type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" + doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span></label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='新建选项'/>" +
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+ "<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><div class='cl'></div>");
} }