2015-01-14 10:05:05 +08:00
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
|
<title>问卷调查_问卷编辑</title>
|
|
|
|
|
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
2015-01-15 16:10:24 +08:00
|
|
|
|
<%#= javascript_include_tag "polls" %>
|
2015-01-14 10:05:05 +08:00
|
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2015-01-15 16:10:24 +08:00
|
|
|
|
function add_MC(){
|
|
|
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
|
|
|
|
|
$("#poll_questions_title").focus();
|
|
|
|
|
}
|
|
|
|
|
function add_MCQ(){
|
|
|
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
|
|
|
|
|
$("#poll_questions_title").focus();
|
|
|
|
|
}
|
|
|
|
|
function add_single(){
|
|
|
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
|
|
|
|
|
$("#poll_questions_title").focus();
|
|
|
|
|
}
|
|
|
|
|
function add_mulit(){
|
|
|
|
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
|
|
|
|
|
$("#poll_questions_title").focus();
|
|
|
|
|
}
|
2015-01-29 16:53:11 +08:00
|
|
|
|
|
2015-01-29 17:01:19 +08:00
|
|
|
|
//添加标题时确定按钮
|
2015-01-30 10:24:06 +08:00
|
|
|
|
function add_poll_question(doc)
|
2015-01-29 16:53:11 +08:00
|
|
|
|
{
|
|
|
|
|
var title = $.trim($("#poll_questions_title").val());
|
|
|
|
|
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
|
|
|
|
|
}
|
2015-01-29 17:01:19 +08:00
|
|
|
|
//修改标题时确定按钮
|
2015-01-30 10:24:06 +08:00
|
|
|
|
function edit_poll_question(doc,id)
|
2015-01-29 17:01:19 +08:00
|
|
|
|
{
|
|
|
|
|
var title = $.trim($("#poll_questions_title_" + id).val());
|
|
|
|
|
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
|
|
|
|
|
}
|
2015-01-29 16:53:11 +08:00
|
|
|
|
|
2015-01-15 10:50:08 +08:00
|
|
|
|
//问卷头
|
2015-01-15 14:09:27 +08:00
|
|
|
|
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
2015-01-23 14:25:29 +08:00
|
|
|
|
function pollsSubmit(doc){
|
|
|
|
|
var title = $.trim($("#polls_title").val());
|
|
|
|
|
if(title.length == 0){alert("问卷标题不能为空");}else{doc.parent().parent().parent().submit();}
|
|
|
|
|
}
|
2015-01-15 14:09:27 +08:00
|
|
|
|
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
2015-01-15 16:44:35 +08:00
|
|
|
|
//
|
|
|
|
|
function pollQuestionCancel(question_id){
|
|
|
|
|
$("#show_poll_questions_"+question_id).show();
|
|
|
|
|
$("#edit_poll_questions_"+question_id).hide();
|
|
|
|
|
}
|
|
|
|
|
function pollQuestionEdit(question_id){
|
|
|
|
|
$("#show_poll_questions_"+question_id).hide();
|
|
|
|
|
$("#edit_poll_questions_"+question_id).show();
|
|
|
|
|
$("#poll_questions_title_"+question_id).focus();
|
|
|
|
|
}
|
2015-01-14 14:23:41 +08:00
|
|
|
|
//单选题
|
|
|
|
|
function add_single_answer(doc)
|
|
|
|
|
{
|
2015-01-17 11:05:38 +08:00
|
|
|
|
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='新建选项'/>" +
|
2015-01-14 15:35:04 +08:00
|
|
|
|
"<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>");
|
2015-01-14 14:23:41 +08:00
|
|
|
|
}
|
|
|
|
|
function remove_single_answer(doc)
|
|
|
|
|
{
|
|
|
|
|
if(doc.parent().siblings("li").length == 0)
|
|
|
|
|
{
|
2015-01-16 10:11:17 +08:00
|
|
|
|
alert("选择题至少有一个选项");
|
2015-01-14 14:23:41 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
doc.parent().remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-16 17:21:33 +08:00
|
|
|
|
|
|
|
|
|
function poll_submit()
|
|
|
|
|
{
|
2015-01-23 14:25:29 +08:00
|
|
|
|
var title = $.trim($("#polls_name_h").html());
|
|
|
|
|
if(title.length == 0)
|
|
|
|
|
{
|
|
|
|
|
alert("问卷标题不能为空");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>');
|
|
|
|
|
showModal('ajax-modal', '310px');
|
2015-01-26 14:09:56 +08:00
|
|
|
|
$('#ajax-modal').css('height','120px');
|
2015-01-23 14:25:29 +08:00
|
|
|
|
$('#ajax-modal').siblings().remove();
|
|
|
|
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
|
|
|
|
"<a href='#' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
|
|
|
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
|
|
|
|
$('#ajax-modal').parent().css("top","").css("left","");
|
|
|
|
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
|
|
|
}
|
2015-01-16 17:21:33 +08:00
|
|
|
|
}
|
2015-01-14 10:05:05 +08:00
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
<div class=" polls_content polls_edit" id="polls">
|
|
|
|
|
|
2015-01-16 13:44:20 +08:00
|
|
|
|
<!-- 头部 -->
|
2015-01-16 13:54:06 +08:00
|
|
|
|
<div id="polls_head_show" style="display: none;">
|
2015-01-16 13:44:20 +08:00
|
|
|
|
<%= render :partial => 'show_head', :locals => {:poll => @poll}%>
|
|
|
|
|
</div>
|
2015-01-16 13:54:06 +08:00
|
|
|
|
<div id="polls_head_edit">
|
2015-01-16 13:44:20 +08:00
|
|
|
|
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 问题 -->
|
|
|
|
|
<div id="poll_content">
|
|
|
|
|
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
|
|
|
|
|
</div>
|
|
|
|
|
|
2015-01-14 10:05:05 +08:00
|
|
|
|
<div class="tabs_1">
|
|
|
|
|
<ul class="tabs_list">
|
|
|
|
|
<li class="tab_item02 " >
|
|
|
|
|
<a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
|
|
|
|
|
<%= l(:label_MC) %>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="tab_item02 " >
|
|
|
|
|
<a title="<%= l(:label_MCQ) %>" class=" tab_icon icon_checkbox" onclick="add_MCQ();">
|
|
|
|
|
<%= l(:label_MCQ) %>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="tab_item02 " >
|
|
|
|
|
<a title="<%= l(:label_single) %>" class="tab_icon icon_text" onclick="add_single();">
|
|
|
|
|
<%= l(:label_single) %>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="tab_item02 " >
|
|
|
|
|
<a title="<%= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();">
|
|
|
|
|
<%= l(:label_mulit)%>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div><!--选项 end-->
|
|
|
|
|
|
2015-01-15 16:31:40 +08:00
|
|
|
|
<!-- 新增问题 -->
|
|
|
|
|
<div id="new_poll_question">
|
2015-01-14 10:05:05 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="ur_buttons">
|
2015-01-16 17:21:33 +08:00
|
|
|
|
<a class="ur_button_submit" onclick="poll_submit();">
|
2015-01-14 10:05:05 +08:00
|
|
|
|
<%= l(:label_memo_create)%>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
</div><!--编辑end-->
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|