问卷调整
This commit is contained in:
parent
5d7af65bac
commit
a00fd27eee
|
@ -133,7 +133,27 @@ class PollController < ApplicationController
|
|||
def get_poll_everycount poll_answer
|
||||
@every_answer_count = poll_answer.poll_votes.count
|
||||
end
|
||||
|
||||
|
||||
def update_question_num
|
||||
member = SyllabusMember.find(params[:id])
|
||||
@syllabus = member.syllabus
|
||||
members = @syllabus.syllabus_members
|
||||
if params[:opr] == 'up' && member.rank > 1
|
||||
before_mem = members.where("rank = #{member.rank - 1}").first
|
||||
if before_mem && member.update_attribute('rank', member.rank - 1)
|
||||
before_mem.update_attribute('rank', before_mem.rank + 1)
|
||||
end
|
||||
elsif params[:opr] == 'down' && member.rank < members.count
|
||||
after_mem = members.where("rank = #{member.rank + 1}").first
|
||||
if after_mem && member.update_attribute('rank', member.rank + 1)
|
||||
after_mem.update_attribute('rank', after_mem.rank - 1)
|
||||
end
|
||||
end
|
||||
@members = @syllabus.syllabus_members.order("rank asc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#添加题目
|
||||
def create_poll_question
|
||||
|
@ -174,7 +194,6 @@ class PollController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#修改题目
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="poll-container">
|
||||
<div class="pool-tool-bar">
|
||||
<p class="mt10 mb10">
|
||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
||||
<span class="questionLabel"><%= poll_question.question_number%></span>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="c_red questionLabel ml5" title="必答">*</span>
|
||||
<%end%>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="poll-container">
|
||||
<div class="pool-tool-bar">
|
||||
<p class="mt10 mb10">
|
||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
||||
<span class="questionLabel"><%= poll_question.question_number%></span>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="c_red questionLabel ml5" title="必答">*</span>
|
||||
<%end%>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="poll-container">
|
||||
<div class="pool-tool-bar">
|
||||
<p class="mt10 mb10">
|
||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
||||
<span class="questionLabel"><%= poll_question.question_number%></span>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="c_red questionLabel ml5" title="必答">*</span>
|
||||
<%end%>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="poll-container">
|
||||
<div class="pool-tool-bar">
|
||||
<p class="mt10 mb10">
|
||||
<span class="questionLabel">第<%= poll_question.question_number%>题:</span>
|
||||
<span class="questionLabel"><%= poll_question.question_number%></span>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="c_red questionLabel ml5" title="必答">*</span>
|
||||
<%end%>
|
||||
|
|
|
@ -2,41 +2,28 @@
|
|||
$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>');
|
||||
<% else %>
|
||||
$("#new_poll_question_new").html("");
|
||||
<%if @poll_questions.question_type == 1%>
|
||||
$("#mc_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<%elsif @poll_questions.question_type == 2%>
|
||||
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<%elsif @poll_questions.question_type == 3%>
|
||||
$("#single_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<%elsif @poll_questions.question_type == 4%>
|
||||
$("#multi_question_list").show().append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<% if @poll_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<% if @poll_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue