diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 48b1af43a..e94b0f132 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -114,7 +114,12 @@ class PollController < ApplicationController #修改单选题 def update_poll_question - a = 1 + @poll_question = PollQuestion.find params[:poll_question] + @poll = @poll_question.poll + + respond_to do |format| + format.js + end end #删除单选题 diff --git a/app/views/poll/_edit_MC.html.erb b/app/views/poll/_edit_MC.html.erb index 6010132fb..fa0e8d802 100644 --- a/app/views/poll/_edit_MC.html.erb +++ b/app/views/poll/_edit_MC.html.erb @@ -1,33 +1,31 @@ -<%= form_for poll_question,:url =>update_poll_question_poll_path(@poll.id),:remote => true do |f|%> -
- -
-
- - - - /> - -
-
-
    - <% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> -
  • - - - - -
  • -
    - <% end%> -
-
- -
+<%= form_for(poll_question,:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%> + +
+
+ + + + /> +
- +
+
    + <% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> +
  • + + + + +
  • +
    + <% end%> +
+
+ +
+ <% end%> \ No newline at end of file diff --git a/app/views/poll/update_poll_question.js.erb b/app/views/poll/update_poll_question.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index 14f23b5f4..e089e8420 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -62,10 +62,10 @@ RedmineApp::Application.routes.draw do member do get 'statistics_result' post 'create_poll_question' - post 'update_poll_question' end collection do delete 'delete_poll_question' + post 'update_poll_question' end end