From 65a3ddce41b921f5f3b0ec13867db4f451aad6d1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 16 Jan 2015 15:05:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8D=95=E8=A1=8C=E6=96=87=E5=AD=97=E5=8A=9F=E8=83=BD=202?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E6=94=B9=E9=A2=98=E7=9B=AE=E5=90=8E=E6=80=BB?= =?UTF-8?q?=E6=98=AF=E6=98=BE=E7=A4=BA=E4=B8=BA=E5=8D=95=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 3 +-- app/views/poll/_edit_single.html.erb | 14 +++++++---- app/views/poll/_new_single.html.erb | 29 ++++++++++++---------- app/views/poll/_show_single.html.erb | 14 ++++++++--- app/views/poll/update_poll_question.js.erb | 20 +++++++++++++-- 5 files changed, 55 insertions(+), 25 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 9c5f810c6..fc23166ff 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -119,8 +119,7 @@ class PollController < ApplicationController #修改单选题 def update_poll_question @poll_question = PollQuestion.find params[:poll_question] - @poll = @poll_question.poll - + #@poll = @poll_question.poll @poll_question.is_necessary = params[:is_necessary]=="true" ? 1 : 0 @poll_question.question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title] ################处理选项 diff --git a/app/views/poll/_edit_single.html.erb b/app/views/poll/_edit_single.html.erb index 4e98babe4..b8157ee6c 100644 --- a/app/views/poll/_edit_single.html.erb +++ b/app/views/poll/_edit_single.html.erb @@ -1,13 +1,17 @@ +<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%>
- - + + + />
-
\ No newline at end of file + +<% end%> \ No newline at end of file diff --git a/app/views/poll/_new_single.html.erb b/app/views/poll/_new_single.html.erb index b7d5a9725..ec06933a8 100644 --- a/app/views/poll/_new_single.html.erb +++ b/app/views/poll/_new_single.html.erb @@ -1,13 +1,16 @@ -
-
- - - - -
- -
-
\ No newline at end of file +<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%> +
+
+ + + + + +
+ +
+
+<% end%> \ No newline at end of file diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 437e38044..d9ef2abc7 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -1,9 +1,17 @@
- 第3题: 单行文字 + + 第<%= poll_question.question_number%>题: + + <%= poll_question.question_title %> + <%if poll_question.is_necessary == 1%> + * + <%end%> + (单行文字)
- - + <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), + method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
diff --git a/app/views/poll/update_poll_question.js.erb b/app/views/poll/update_poll_question.js.erb index 39d0fcfd6..e0727df67 100644 --- a/app/views/poll/update_poll_question.js.erb +++ b/app/views/poll/update_poll_question.js.erb @@ -1,6 +1,22 @@ $("#poll_questions_<%= @poll_question.id%>").html("
" + - "<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" + + "<% if @poll_question.question_type == 1%>" + + "<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" + + "<% elsif @poll_question.question_type == 2%>" + + "<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_question}) %>" + + "<% elsif @poll_question.question_type == 3%>" + + "<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_question}) %>" + + "<% elsif @poll_question.question_type == 4%>" + + "<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_question}) %>" + + "<% end%>" + "
" + "");