问卷调查显示页面的调整
This commit is contained in:
parent
f3d67dc26a
commit
5d7af65bac
|
@ -7,8 +7,8 @@
|
||||||
<%= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
|
||||||
<% elsif poll_question.question_type == 3%>
|
<% elsif poll_question.question_type == 3%>
|
||||||
<%= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
|
||||||
<%# elsif poll_question.question_type == 4%>
|
<% elsif poll_question.question_type == 4%>
|
||||||
<%#= render :partial => 'show_mulit', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'show_mulit', :locals => {:poll_question => poll_question} %>
|
||||||
<% end%>
|
<% end%>
|
||||||
</div>
|
</div>
|
||||||
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
|
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
|
||||||
<% elsif poll_question.question_type == 3%>
|
<% elsif poll_question.question_type == 3%>
|
||||||
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
|
||||||
<%# elsif poll_question.question_type == 4%>
|
<% elsif poll_question.question_type == 4%>
|
||||||
<%#= render :partial => 'edit_mulit', :locals => {:poll_question => poll_question} %>
|
<%= render :partial => 'edit_mulit', :locals => {:poll_question => poll_question} %>
|
||||||
<% end%>
|
<% end%>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,22 +1,38 @@
|
||||||
<div>
|
<div class="poll-container">
|
||||||
<div class="testEditTitle">
|
<div class="pool-tool-bar">
|
||||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
<p class="mt10 mb10">
|
||||||
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
|
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
||||||
<%if poll_question.is_necessary == 1%>
|
<%if poll_question.is_necessary == 1%>
|
||||||
<span class="ur_required questionLabel ml5" title="必答">*</span>
|
<span class="c_red questionLabel ml5" title="必答">*</span>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
</p>
|
||||||
|
<a class="poll-up mb8" title="上移"></a>
|
||||||
|
<a class="poll-down mb8" title="下移"></a>
|
||||||
|
<a href="javascript:void(0);" class="poll-add pr mb8">
|
||||||
|
<ul class="poll-add-menu fontGrey3">
|
||||||
|
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MC('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">单选题</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_MCQ('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">多选题</a></li>
|
||||||
|
<li><a href="javascript:void(0);" onclick=" dismiss('mulit',<%=poll_question.id%>);insert_SINGLE('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);">主观题</a></li>
|
||||||
|
</ul>
|
||||||
|
</a>
|
||||||
|
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||||
|
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "poll-delete", :title => "删除") %>
|
||||||
|
</div>
|
||||||
|
<div class="poll-content">
|
||||||
|
<div class="testEditTitle">
|
||||||
|
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
|
||||||
|
<span class="fontBlue">[多行主观题]</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
|
||||||
|
<div class="ml40 mb10">
|
||||||
|
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
|
||||||
|
<input type="text" class="questionnaire-input" name="<%= poll_question %>" style="width:652px;" />
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<%= 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") %>
|
|
||||||
<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="dismiss('mulit',<%=poll_question.id%>);insert_MULIT('mulit',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<% poll_question.poll_answers.reorder("answer_position").each_with_index do |poll_answer, i| %>
|
|
||||||
<div class="ml40 mb10">
|
|
||||||
<p class="mb10"><%= i + 1 %>.<%= poll_answer.answer_text%></p>
|
|
||||||
<input type="text" class="questionnaire-input" name="<%= poll_question %>" style="width:652px;" />
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div><!--多行展示 end-->
|
</div><!--多行展示 end-->
|
||||||
<!-- 新增问题 -->
|
<!-- 新增问题 -->
|
||||||
<div id="insert_new_poll_question_mulit_<%=poll_question.id%>">
|
<div id="insert_new_poll_question_mulit_<%=poll_question.id%>">
|
||||||
|
|
|
@ -27,46 +27,9 @@
|
||||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="ur_inputs">
|
<div class="ur_inputs">
|
||||||
<table class="ur_table" style="width:647px;">
|
<input class="questionnaire-input" type="text" size="" maxlength="" value="" style="width:692px;">
|
||||||
<tbody>
|
|
||||||
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<% if poll_answer.answer_text != '' %>
|
|
||||||
<label>
|
|
||||||
<input class="ur_radio" type="radio" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
|
|
||||||
<%= poll_answer.answer_text%>
|
|
||||||
</label>
|
|
||||||
<% else %>
|
|
||||||
<label>
|
|
||||||
<input class="ur_radio" name="<%= poll_question %>" value="" type="radio">
|
|
||||||
</label>
|
|
||||||
<input placeholder="其它" readonly="readonly" class="disabled questionnaire-input w300" type="text">
|
|
||||||
<% end %>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div><!--单选题显示 end-->
|
|
||||||
<div>
|
|
||||||
<div class="testEditTitle">
|
|
||||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
|
||||||
<span class="formatContainer m_w500"><%= poll_question.question_title %></span>
|
|
||||||
<%if poll_question.is_necessary == 1%>
|
|
||||||
<span class="ur_required questionLabel ml5" title="必答">*</span>
|
|
||||||
<%end%>
|
|
||||||
</div>
|
|
||||||
<%= 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") %>
|
|
||||||
<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="dismiss('single',<%=poll_question.id%>);insert_SINGLE('single',<%=poll_question.question_number%>,<%=poll_question.id%>);"></a>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<div class="ur_inputs">
|
|
||||||
<input class="questionnaire-input" type="text" size="" maxlength="" value="" style="width:692px;">
|
|
||||||
</div>
|
|
||||||
</div><!--单行文字展示 end-->
|
</div><!--单行文字展示 end-->
|
||||||
<!-- 新增问题 -->
|
<!-- 新增问题 -->
|
||||||
<div id="insert_new_poll_question_single_<%=poll_question.id%>">
|
<div id="insert_new_poll_question_single_<%=poll_question.id%>">
|
||||||
|
|
|
@ -1,307 +1,302 @@
|
||||||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||||
<div class="homepageRight mt0 ml10">
|
<div class="homepageRight mt0 ml10">
|
||||||
<div class="resources" id="polls">
|
<div class="resources" id="polls">
|
||||||
<div class="testStatus" >
|
<div class="testStatus">
|
||||||
<h1 class="ur_page_title">
|
<h1 class="ur_page_title">
|
||||||
<%= @poll.polls_name%>
|
<%= @poll.polls_name %>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<% mc_question_list = @poll.poll_questions.where("question_type=1") %>
|
<div class="testDesEdit mt5"><%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe %></div>
|
||||||
<% mcq_question_list = @poll.poll_questions.where("question_type=2") %>
|
</div>
|
||||||
<% single_question_list = @poll.poll_questions.where("question_type=3") %>
|
|
||||||
<% multi_question_list = @poll.poll_questions.where("question_type=4") %>
|
<% @poll_questions.each do |pq| %>
|
||||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
<% if pq.question_type == 1 %>
|
||||||
<h3 class="fontGrey3">单选题</h3>
|
<!-- 单选题 -->
|
||||||
<% mc_question_list.each_with_index do |pq, list_index| %>
|
<div class="testStatus">
|
||||||
<div id="poll_questions_<%= pq.id%>">
|
<div id="poll_questions_<%= pq.id %>">
|
||||||
<div id="show_poll_questions_<%= pq.id %>">
|
<div id="show_poll_questions_<%= pq.id %>">
|
||||||
<div>
|
<div>
|
||||||
<div class="testEditTitle">
|
<div class="testEditTitle">
|
||||||
<%= l(:label_question_number,:question_number => pq.question_number) %>
|
<%= l(:label_question_number, :question_number => pq.question_number) %>
|
||||||
<%= pq.question_title %>
|
<%= pq.question_title %>
|
||||||
<% if pq.is_necessary == 1 %>
|
<span class="fontBlue">[单选题]</span>
|
||||||
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
<% if pq.is_necessary == 1 %>
|
||||||
<% end %>
|
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
||||||
</div>
|
<% end %>
|
||||||
<div class="cl"></div>
|
</div>
|
||||||
<div class="ur_inputs">
|
<div class="cl"></div>
|
||||||
<table class="ur_table" style="width:675px;">
|
<div class="ur_inputs">
|
||||||
<tbody>
|
<table class="ur_table" style="width:675px;">
|
||||||
<% pq.poll_answers.each do |pa| %>
|
<tbody>
|
||||||
<tr>
|
<% pq.poll_answers.each do |pa| %>
|
||||||
<td>
|
<tr>
|
||||||
<label>
|
<td>
|
||||||
<script>
|
<label>
|
||||||
function onblur_<%= pa.id %>(obj)
|
<script>
|
||||||
{
|
function onblur_<%= pa.id %>(obj) {
|
||||||
$(window).unbind('beforeunload');
|
$(window).unbind('beforeunload');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
data: {
|
data: {
|
||||||
poll_question_id: <%= pq.id %>,
|
poll_question_id: <%= pq.id %>,
|
||||||
poll_answer_id: <%= pa.id %>,
|
poll_answer_id: <%= pa.id %>,
|
||||||
vote_text: obj.value
|
vote_text: obj.value
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var dataObj = eval(data);
|
var dataObj = eval(data);
|
||||||
//document.getElementById("poll_vote_<%#=pq.id %>poll_answer_id_<%#=pa.id %>").checked = true;
|
//document.getElementById("poll_vote_<%#=pq.id %>poll_answer_id_<%#=pa.id %>").checked = true;
|
||||||
//var span = $('#percent');
|
//var span = $('#percent');
|
||||||
//span.html(dataObj.percent);
|
//span.html(dataObj.percent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function click_<%= pa.id %>(obj)
|
function click_<%= pa.id %>(obj) {
|
||||||
{
|
$.ajax({
|
||||||
$.ajax({
|
type: "post",
|
||||||
type: "post",
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
data: {
|
||||||
data: {
|
poll_answer_id: <%= pa.id %>,
|
||||||
poll_answer_id: <%= pa.id %>,
|
poll_question_id: <%= pq.id %>
|
||||||
poll_question_id: <%= pq.id %>
|
},
|
||||||
},
|
success: function (data) {
|
||||||
success: function (data) {
|
var dataObj = eval(data);
|
||||||
var dataObj = eval(data);
|
if (dataObj.text == "ok") {
|
||||||
if(dataObj.text == "ok")
|
obj.checked = true;
|
||||||
{
|
$(obj).parent().parent().parent().parent().find("input[type='text']").attr("disabled", "disabled");
|
||||||
obj.checked = true;
|
$(obj).next('input').removeAttr("disabled");
|
||||||
$(obj).parent().parent().parent().parent().find("input[type='text']").attr("disabled", "disabled");
|
}
|
||||||
$(obj).next('input').removeAttr("disabled");
|
else {
|
||||||
}
|
obj.checked = false;
|
||||||
else
|
$(obj).next('input').attr("disabled", "disabled");
|
||||||
{
|
}
|
||||||
obj.checked = false;
|
var span = $('#percent');
|
||||||
$(obj).next('input').attr("disabled", "disabled");
|
span.html(dataObj.percent);
|
||||||
}
|
},
|
||||||
var span = $('#percent');
|
error: function () {
|
||||||
span.html(dataObj.percent);
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
},
|
}
|
||||||
error: function () {
|
});
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
}
|
||||||
}
|
</script>
|
||||||
});
|
<%= radio_button "poll_vote", pq.id.to_s+"poll_answer_id", pa.id, :class => "ur_radio", :onclick => "click_#{pa.id}(this);return false;", :checked => answer_be_selected?(pa, User.current), :disabled => !@can_edit_poll %>
|
||||||
}
|
<% if pa.answer_text == "" %>
|
||||||
</script>
|
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id, User.current.id, pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= (@can_edit_poll && answer_be_selected?(pa, User.current)) ? "" : "disabled=disabled" %> placeholder="其他">
|
||||||
<%= radio_button "poll_vote",pq.id.to_s+"poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %>
|
<% else %>
|
||||||
<% if pa.answer_text == "" %>
|
<%= pa.answer_text %>
|
||||||
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id,User.current.id,pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= (@can_edit_poll && answer_be_selected?(pa,User.current))?"":"disabled=disabled" %> placeholder="其他">
|
<% end %>
|
||||||
<% else %>
|
</label>
|
||||||
<%= pa.answer_text %>
|
</td>
|
||||||
<% end %>
|
</tr>
|
||||||
</label>
|
<% end %>
|
||||||
</td>
|
</tbody>
|
||||||
</tr>
|
</table>
|
||||||
<% end %>
|
</div>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<% elsif pq.question_type == 2 %>
|
||||||
</div>
|
<!-- 多选题 -->
|
||||||
<% end %>
|
<div class="testStatus">
|
||||||
</div>
|
<div id="poll_questions_<%= pq.id %>">
|
||||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
<div id="show_poll_questions_<%= pq.id %>">
|
||||||
<h3 class="fontGrey3">多选题</h3>
|
<div>
|
||||||
<% mcq_question_list.each do |pq| %>
|
<div class="testEditTitle">
|
||||||
<div id="poll_questions_<%= pq.id%>">
|
<%= l(:label_question_number, :question_number => pq.question_number) %>
|
||||||
<div id="show_poll_questions_<%= pq.id %>">
|
<%= pq.question_title %>
|
||||||
<div>
|
<span class="fontBlue">[多选题]</span>
|
||||||
<div class="testEditTitle">
|
<% if pq.is_necessary == 1 %>
|
||||||
<%= l(:label_question_number,:question_number => pq.question_number) %>
|
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
||||||
<%= pq.question_title %>
|
<% end %>
|
||||||
<% if pq.is_necessary == 1 %>
|
</div>
|
||||||
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
<div class="cl"></div>
|
||||||
<% end %>
|
<div class="ur_inputs">
|
||||||
</div>
|
<table class="ur_table" style="width:675px;">
|
||||||
<div class="cl"></div>
|
<tbody>
|
||||||
<div class="ur_inputs">
|
<% pq.poll_answers.each do |pa| %>
|
||||||
<table class="ur_table" style="width:675px;">
|
<tr>
|
||||||
<tbody>
|
<td>
|
||||||
<% pq.poll_answers.each do |pa| %>
|
<label>
|
||||||
<tr>
|
<script>
|
||||||
<td>
|
function onblur_<%= pa.id %>(obj) {
|
||||||
<label>
|
$(window).unbind('beforeunload');
|
||||||
<script>
|
$.ajax({
|
||||||
function onblur_<%= pa.id %>(obj)
|
type: "post",
|
||||||
{
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
$(window).unbind('beforeunload');
|
data: {
|
||||||
$.ajax({
|
poll_question_id: <%= pq.id %>,
|
||||||
type: "post",
|
poll_answer_id: <%= pa.id %>,
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
vote_text: obj.value
|
||||||
data: {
|
},
|
||||||
poll_question_id: <%= pq.id %>,
|
success: function (data) {
|
||||||
poll_answer_id: <%= pa.id %>,
|
var dataObj = eval(data);
|
||||||
vote_text: obj.value
|
//document.getElementById("poll_vote_<%#=pq.id %>poll_answer_id_<%#=pa.id %>").checked = true;
|
||||||
},
|
//var span = $('#percent');
|
||||||
success: function (data) {
|
//span.html(dataObj.percent);
|
||||||
var dataObj = eval(data);
|
}
|
||||||
//document.getElementById("poll_vote_<%#=pq.id %>poll_answer_id_<%#=pa.id %>").checked = true;
|
});
|
||||||
//var span = $('#percent');
|
}
|
||||||
//span.html(dataObj.percent);
|
function click_<%= pa.id %>(obj) {
|
||||||
}
|
$.ajax({
|
||||||
});
|
type: "post",
|
||||||
}
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
function click_<%= pa.id %>(obj)
|
data: {
|
||||||
{
|
poll_answer_id: <%= pa.id %>,
|
||||||
$.ajax({
|
poll_question_id: <%= pq.id %>
|
||||||
type: "post",
|
},
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
success: function (data) {
|
||||||
data: {
|
var dataObj = eval(data);
|
||||||
poll_answer_id: <%= pa.id %>,
|
if (dataObj.text == "ok") {
|
||||||
poll_question_id: <%= pq.id %>
|
obj.checked = true;
|
||||||
},
|
$(obj).next('input').removeAttr("disabled");
|
||||||
success: function (data) {
|
}
|
||||||
var dataObj = eval(data);
|
else {
|
||||||
if(dataObj.text == "ok")
|
obj.checked = false;
|
||||||
{
|
$(obj).next('input').attr("disabled", "disabled");
|
||||||
obj.checked = true;
|
}
|
||||||
$(obj).next('input').removeAttr("disabled");
|
var span = $('#percent');
|
||||||
}
|
span.html(dataObj.percent);
|
||||||
else
|
},
|
||||||
{
|
error: function () {
|
||||||
obj.checked = false;
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
$(obj).next('input').attr("disabled", "disabled");
|
}
|
||||||
}
|
});
|
||||||
var span = $('#percent');
|
}
|
||||||
span.html(dataObj.percent);
|
</script>
|
||||||
},
|
<input class="ur_radio" id="poll_vote_<%= pq.id %>poll_answer_id_<%= pa.id %>" type="checkbox" onclick="click_<%= pa.id %>(this);return false;" <%= answer_be_selected?(pa, User.current) ? "checked" : "" %> <%= @can_edit_poll ? "" : "disabled=disabled" %> >
|
||||||
error: function () {
|
<% if pa.answer_text == "" %>
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id, User.current.id, pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= (@can_edit_poll && answer_be_selected?(pa, User.current)) ? "" : "disabled=disabled" %> placeholder="其他">
|
||||||
}
|
<% else %>
|
||||||
});
|
<%= pa.answer_text %>
|
||||||
}
|
<% end %>
|
||||||
</script>
|
</label>
|
||||||
<input class="ur_radio" id="poll_vote_<%=pq.id %>poll_answer_id_<%=pa.id %>" type="checkbox" onclick="click_<%= pa.id %>(this);return false;" <%= answer_be_selected?(pa,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
|
</td>
|
||||||
<% if pa.answer_text == "" %>
|
</tr>
|
||||||
<input class="ur_text ur_textbox" type="text" size="" maxlength="" style="width: 93%" value="<%= get_anwser_vote_text(pq.id,User.current.id,pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= (@can_edit_poll && answer_be_selected?(pa,User.current))?"":"disabled=disabled" %> placeholder="其他">
|
<% end %>
|
||||||
<% else %>
|
</tbody>
|
||||||
<%= pa.answer_text %>
|
</table>
|
||||||
<% end %>
|
</div>
|
||||||
</label>
|
</div>
|
||||||
</td>
|
<!--多选题显示 end-->
|
||||||
</tr>
|
</div>
|
||||||
<% end %>
|
</div>
|
||||||
</tbody>
|
</div>
|
||||||
</table>
|
<% elsif pq.question_type == 3 %>
|
||||||
</div>
|
<!-- 单行文字-->
|
||||||
</div><!--多选题显示 end-->
|
<div class="testStatus">
|
||||||
</div>
|
<div id="poll_questions_<%= pq.id %>">
|
||||||
</div>
|
<div id="show_poll_questions_<%= pq.id %>">
|
||||||
<% end %>
|
<div>
|
||||||
</div>
|
<div class="testEditTitle">
|
||||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
<%= l(:label_question_number, :question_number => pq.question_number) %>
|
||||||
<h3 class="fontGrey3">单行主观题</h3>
|
<%= pq.question_title %>
|
||||||
<% single_question_list.each do |pq| %>
|
<span class="fontBlue">[主观题]</span>
|
||||||
<div id="poll_questions_<%= pq.id%>">
|
<% if pq.is_necessary == 1 %>
|
||||||
<div id="show_poll_questions_<%= pq.id %>">
|
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
||||||
<div>
|
<% end %>
|
||||||
<div class="testEditTitle">
|
</div>
|
||||||
<%= l(:label_question_number,:question_number => pq.question_number) %>
|
<div class="cl"></div>
|
||||||
<%= pq.question_title %>
|
<div>
|
||||||
<% if pq.is_necessary == 1 %>
|
<script>
|
||||||
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
function onblur_<%= pq.id %>(obj) {
|
||||||
<% end %>
|
$(window).unbind('beforeunload');
|
||||||
</div>
|
var val = $(obj).val().trim();
|
||||||
<div class="cl"></div>
|
if (val != "") {
|
||||||
<div>
|
$.ajax({
|
||||||
<script>
|
type: "post",
|
||||||
function onblur_<%= pq.id %>(obj)
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
{
|
data: {
|
||||||
$(window).unbind('beforeunload');
|
poll_question_id: <%= pq.id %>,
|
||||||
var val = $(obj).val().trim();
|
vote_text: obj.value
|
||||||
if(val != "") {
|
},
|
||||||
$.ajax({
|
success: function (data) {
|
||||||
type: "post",
|
var dataObj = eval(data);
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
obj.value = dataObj.text;
|
||||||
data: {
|
var span = $('#percent');
|
||||||
poll_question_id: <%= pq.id %> ,
|
span.html(dataObj.percent);
|
||||||
vote_text: obj.value
|
},
|
||||||
},
|
error: function () {
|
||||||
success: function (data) {
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
var dataObj = eval(data);
|
}
|
||||||
obj.value = dataObj.text;
|
});
|
||||||
var span = $('#percent');
|
}
|
||||||
span.html(dataObj.percent);
|
}
|
||||||
},
|
</script>
|
||||||
error: function () {
|
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(pq.id, User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>>
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
</div>
|
||||||
}
|
</div>
|
||||||
});
|
</div>
|
||||||
}
|
</div>
|
||||||
}
|
</div>
|
||||||
</script>
|
<% elsif pq.question_type == 4 %>
|
||||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
<!-- 多行文字-->
|
||||||
</div>
|
<div class="testStatus">
|
||||||
</div>
|
<div id="poll_questions_<%= pq.id %>">
|
||||||
</div>
|
<div id="show_poll_questions_<%= pq.id %>">
|
||||||
</div>
|
<div>
|
||||||
<% end %>
|
<div class="testEditTitle">
|
||||||
</div>
|
<%= l(:label_question_number, :question_number => pq.question_number) %>
|
||||||
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
|
<%= pq.question_title %>
|
||||||
<h3 class="fontGrey3">多行主观题</h3>
|
<span class="fontBlue">[多行主观题]</span>
|
||||||
<% multi_question_list.each do |pq| %>
|
<% if pq.is_necessary == 1 %>
|
||||||
<div id="poll_questions_<%= pq.id%>">
|
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
||||||
<div id="show_poll_questions_<%= pq.id %>">
|
<% end %>
|
||||||
<div>
|
</div>
|
||||||
<div class="testEditTitle">
|
<div class="cl"></div>
|
||||||
<%= l(:label_question_number,:question_number => pq.question_number) %>
|
<% pq.poll_answers.each_with_index do |pa, i| %>
|
||||||
<%= pq.question_title %>
|
<div class="ml20 mb10">
|
||||||
<% if pq.is_necessary == 1 %>
|
<script>
|
||||||
<span class="ur_required" title="<%= l(:label_must_answer) %>">*</span>
|
function onblur_<%= pa.id %>(obj) {
|
||||||
<% end %>
|
$(window).unbind('beforeunload');
|
||||||
</div>
|
var val = $(obj).val().trim();
|
||||||
<div class="cl"></div>
|
if (val != "") {
|
||||||
<% pq.poll_answers.each_with_index do |pa, i| %>
|
$.ajax({
|
||||||
<div class="ml40 mb10">
|
type: "post",
|
||||||
<script>
|
url: "<%= commit_answer_poll_path(@poll) %>",
|
||||||
function onblur_<%= pa.id %>(obj)
|
data: {
|
||||||
{
|
poll_question_id: <%= pq.id %>,
|
||||||
$(window).unbind('beforeunload');
|
poll_answer_id: <%= pa.id %>,
|
||||||
var val = $(obj).val().trim();
|
vote_text: obj.value
|
||||||
if(val != "") {
|
},
|
||||||
$.ajax({
|
success: function (data) {
|
||||||
type: "post",
|
var dataObj = eval(data);
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
obj.value = dataObj.text;
|
||||||
data: {
|
var span = $('#percent');
|
||||||
poll_question_id: <%= pq.id %>,
|
span.html(dataObj.percent);
|
||||||
poll_answer_id: <%= pa.id %>,
|
},
|
||||||
vote_text: obj.value
|
error: function () {
|
||||||
},
|
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||||
success: function (data) {
|
}
|
||||||
var dataObj = eval(data);
|
});
|
||||||
obj.value = dataObj.text;
|
}
|
||||||
var span = $('#percent');
|
}
|
||||||
span.html(dataObj.percent);
|
</script>
|
||||||
},
|
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text %></p>
|
||||||
error: function () {
|
<input class="questionnaire-input" placeholder="在此填入答案" style="width: 99%" type="text" value="<%= get_anwser_vote_text(pq.id, User.current.id, pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>>
|
||||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
</div>
|
||||||
}
|
<% end %>
|
||||||
});
|
</div>
|
||||||
}
|
</div>
|
||||||
}
|
</div>
|
||||||
</script>
|
</div>
|
||||||
<p class="mb10"><%= i + 1 %>.<%= pa.answer_text%></p>
|
<% else %>
|
||||||
<input class="questionnaire-input" placeholder="在此填入答案" style="width: 93%" type="text" value="<%= get_anwser_vote_text(pq.id,User.current.id,pa.id).html_safe %>" onblur="onblur_<%= pa.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
<!-- 未知题型 -->
|
||||||
</div>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
<div class="ur_buttons" style="width: 77px;">
|
||||||
</div>
|
<% if @poll.polls_status == 2 %>
|
||||||
<% end %>
|
<%= link_to l(:button_submit), commit_poll_poll_path(@poll), :method => :post, :class => "BlueCirBtn", :format => 'js', :remote => true %>
|
||||||
</div>
|
<% end %>
|
||||||
<div class="ur_buttons" style="width: 77px;">
|
</div>
|
||||||
<% if @poll.polls_status == 2 %>
|
<div class="cl"></div>
|
||||||
<%= link_to l(:button_submit),commit_poll_poll_path(@poll), :method => :post,:class => "BlueCirBtn",:format => 'js',:remote=>true %>
|
<div class="ur_progress_text">
|
||||||
<% end %>
|
<%= l(:label_complete_question) %>
|
||||||
</div>
|
<strong class="ur_progress_number">
|
||||||
<div class="cl"></div>
|
<span id="percent"><%= format "%.2f", @percent %></span>%
|
||||||
<div class="ur_progress_text">
|
</strong>
|
||||||
<%= l(:label_complete_question) %>
|
</div>
|
||||||
<strong class="ur_progress_number">
|
</div>
|
||||||
<span id="percent"><%= format "%.2f" ,@percent %></span>%
|
<!--问卷内容end-->
|
||||||
</strong>
|
|
||||||
</div>
|
|
||||||
</div><!--问卷内容end-->
|
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue