From 5ec27898810c751942b2c229bc17e06318c54bc9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 17:26:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9F=90=E4=B8=80=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E5=90=8E=EF=BC=8C=E5=90=8E=E9=9D=A2=E7=9A=84=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E5=BA=8F=E5=8F=B7=E8=87=AA=E5=8A=A8-1=EF=BC=8C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E9=A1=B5=E9=9D=A2js=E7=9A=84=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 3 ++- app/views/poll/_poll_content.html.erb | 10 ++++++++++ app/views/poll/_poll_form.html.erb | 11 +---------- app/views/poll/delete_poll_question.js.erb | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 app/views/poll/_poll_content.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 191968183..48b1af43a 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -120,7 +120,8 @@ class PollController < ApplicationController #删除单选题 def delete_poll_question @poll_question = PollQuestion.find params[:poll_question] - poll_questions = @poll_question.poll.poll_questions.where("question_number > #{@poll_question.question_number}") + @poll = @poll_question.poll + poll_questions = @poll.poll_questions.where("question_number > #{@poll_question.question_number}") poll_questions.each do |question| question.question_number -= 1 question.save diff --git a/app/views/poll/_poll_content.html.erb b/app/views/poll/_poll_content.html.erb new file mode 100644 index 000000000..6c2e61215 --- /dev/null +++ b/app/views/poll/_poll_content.html.erb @@ -0,0 +1,10 @@ +<% poll.poll_questions.each do |poll_question|%> +