From 2a23eb8e174b9e78dd7ea087e786a0b7dc8eba18 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 14 Jan 2015 16:15:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E5=8D=95=E9=80=89=E9=A2=98?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=202.=E5=8E=BB=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E9=A1=B5=E9=9D=A2?= 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_form.html.erb | 5 +++ app/views/poll/_question_answer.html.erb | 11 ------- app/views/poll/_show_MC.html.erb | 37 ++++++++++------------ app/views/poll/create_poll_question.js.erb | 0 5 files changed, 23 insertions(+), 33 deletions(-) delete mode 100644 app/views/poll/_question_answer.html.erb create mode 100644 app/views/poll/create_poll_question.js.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 99287e2cd..52b4d8997 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -89,7 +89,8 @@ class PollController < ApplicationController option = { :is_necessary => params[:is_necessary] || true, :question_title => question_title, - :question_type => params[:question_type] || 1 + :question_type => params[:question_type] || 1, + :question_number => @poll.poll_questions.count + 1 } @poll_questions = @poll.poll_questions.new option if params[:question_answer] diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index e2e9a217d..473c1df83 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -62,6 +62,11 @@ <%= render :partial => 'edit_head'%> +
+ <% @poll.poll_questions.each do |poll_question|%> + <%= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %> + <% end%> +
<%#= render :partial => 'edit_MC'%>
diff --git a/app/views/poll/_question_answer.html.erb b/app/views/poll/_question_answer.html.erb deleted file mode 100644 index 765d71787..000000000 --- a/app/views/poll/_question_answer.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
  • - - - - -
  • -
    \ No newline at end of file diff --git a/app/views/poll/_show_MC.html.erb b/app/views/poll/_show_MC.html.erb index b156bc0bc..a33967ffd 100644 --- a/app/views/poll/_show_MC.html.erb +++ b/app/views/poll/_show_MC.html.erb @@ -1,10 +1,13 @@
    - 第<%= question_index%>题: + 第<%= poll_question.question_number%>题: - <%= poll_questions.question_title%> - * + <%= poll_question.question_title %> + <%if poll_question.is_necessary == 1%> + * + <%end%> +
    @@ -12,24 +15,16 @@
    - - - - - - - - - + <% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> + + + + <% end %>
    - -
    - -
    - -
    + +
    diff --git a/app/views/poll/create_poll_question.js.erb b/app/views/poll/create_poll_question.js.erb new file mode 100644 index 000000000..e69de29bb