parent
f41cd0a8ab
commit
9fb0275563
|
@ -122,7 +122,7 @@ class PollController < ApplicationController
|
||||||
################处理选项
|
################处理选项
|
||||||
if params[:question_answer]
|
if params[:question_answer]
|
||||||
@poll_question.poll_answers.each do |answer|
|
@poll_question.poll_answers.each do |answer|
|
||||||
@poll_question.poll_answers.destroy answer unless params[:question_answer].keys.include? answer.id.to_s
|
answer.destroy unless params[:question_answer].keys.include? answer.id.to_s
|
||||||
end
|
end
|
||||||
for i in 1..params[:question_answer].count
|
for i in 1..params[:question_answer].count
|
||||||
question = @poll_question.poll_answers.find_by_id params[:question_answer].keys[i-1]
|
question = @poll_question.poll_answers.find_by_id params[:question_answer].keys[i-1]
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
<tbody>
|
||||||
|
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="ur_radio" type="radio" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
|
||||||
|
<%= poll_answer.answer_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
|
@ -1,2 +1,6 @@
|
||||||
|
$("#poll_questions_<%= @poll_question.id%>").html("<div id='show_poll_questions_<%= @poll_question.id %>'>" +
|
||||||
pollQuestionCancel(<%= @poll_question.id%>);
|
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div id='edit_poll_questions_<%= @poll_question.id %>' style='display: none;'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||||
|
"</div>");
|
||||||
|
|
Loading…
Reference in New Issue