From a99d7c514537762d25c6a04de1db310f5fed39e8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 14:40:17 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=86=E7=A6=BB=E5=87=BA=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E9=97=AE=E5=8D=B7=E9=97=AE=E9=A2=98=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=202=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E7=9B=B8=E5=85=B3=E8=B7=AF=E7=94=B1=E5=8F=8Aaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 7 ++++- app/views/poll/_edit_MC.html.erb | 38 +++++++++--------------- app/views/poll/_new_MC.html.erb | 45 +++++++++++++++++++++++++++++ app/views/poll/_new_MCQ.html.erb | 33 +++++++++++++++++++++ app/views/poll/_new_mulit.html.erb | 18 ++++++++++++ app/views/poll/_new_single.html.erb | 13 +++++++++ app/views/poll/_poll_form.html.erb | 19 +++++++----- config/routes.rb | 1 + 8 files changed, 140 insertions(+), 34 deletions(-) create mode 100644 app/views/poll/_new_MC.html.erb create mode 100644 app/views/poll/_new_MCQ.html.erb create mode 100644 app/views/poll/_new_mulit.html.erb create mode 100644 app/views/poll/_new_single.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 196b3c7ba..a63f9e8f6 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -89,7 +89,7 @@ class PollController < ApplicationController def create_poll_question question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title] option = { - :is_necessary => params[:is_necessary] || true, + :is_necessary => params[:is_necessary] || 1, :question_title => question_title, :question_type => params[:question_type] || 1, :question_number => @poll.poll_questions.count + 1 @@ -112,6 +112,11 @@ class PollController < ApplicationController end end + #修改单选题 + def update_poll_question + a = 1 + end + private def find_poll_and_course @poll = Poll.find params[:id] diff --git a/app/views/poll/_edit_MC.html.erb b/app/views/poll/_edit_MC.html.erb index 0f031f61c..cc52e7c6b 100644 --- a/app/views/poll/_edit_MC.html.erb +++ b/app/views/poll/_edit_MC.html.erb @@ -1,37 +1,25 @@ -<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%> +<%= form_for poll_question,:url =>update_poll_question_poll_path(@poll.id),:remote => true do |f|%>
- - - + + +
    -
  • - - - - -
  • -
    -
  • - - - - -
  • -
    -
  • - - - - -
  • -
    + <% poll_question.poll_answers.reorder("answer_position") do |poll_answer| %> +
  • + + + + +
  • +
    + <% end%>