From 6d82e79e7f231dcd7635991c0265d94a6f95d881 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 15 Jan 2015 09:41:19 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E7=AD=94=E9=A2=98=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 22 +++++++++++++++++- app/helpers/poll_helper.rb | 35 +++++++++++++++++++++++++++++ app/views/poll/commit_answer.js.erb | 3 +++ app/views/poll/show.html.erb | 22 ++++++++++++++++-- config/routes.rb | 1 + 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 app/helpers/poll_helper.rb create mode 100644 app/views/poll/commit_answer.js.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 88bbfff46..3ea1934f5 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -3,7 +3,7 @@ class PollController < ApplicationController before_filter :find_container, :only => [:new,:create, :index] before_filter :is_member_of_course, :only => [:index,:show] before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy] - + include PollHelper def index if @course @is_teacher = User.current.allowed_to?(:as_teacher,@course) @@ -86,6 +86,26 @@ class PollController < ApplicationController end + #提交答案 + def commit_answer + @pv = get_poll_vote(User.current.id,params[:poll_question_id]) + if params[:poll_vote][:poll_answer_id] + @pv.poll_answer_id = params[:poll_vote][:poll_answer_id] + end + if params[:poll_vote][:vote_text] + @pv.vote_text = params[:poll_vote][:vote_text] + end + @pv_saved = false + if @pv.save + @pv_saved = true + end + #respond_to do |format| + # format.js + # format.json + #end + render :text => "ok" + end + private def find_poll_and_course @poll = Poll.find params[:id] diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb new file mode 100644 index 000000000..202f33eaa --- /dev/null +++ b/app/helpers/poll_helper.rb @@ -0,0 +1,35 @@ +# encoding: utf-8 +# +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module PollHelper + def get_poll_vote(user_id,poll_question_id) + pq = PollQuestion.find(poll_question_id) + if pq.question_type == 1 + pv = PollVote.find_by_poll_question_id_and_user_id(poll_question_id,user_id) + if pv.nil? + pv = PollVote.new + pv.user_id = user_id + pv.poll_question_id = poll_question_id + pv + else + pv + end + end + end +end \ No newline at end of file diff --git a/app/views/poll/commit_answer.js.erb b/app/views/poll/commit_answer.js.erb new file mode 100644 index 000000000..b698d8658 --- /dev/null +++ b/app/views/poll/commit_answer.js.erb @@ -0,0 +1,3 @@ +<% if @pv_saved %> +$('#poll_vote_poll_answer_id_<%= @pv.poll_answer_id %>').checked = true; +<% end %> \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 26daa8fc5..08dae18b2 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -4,6 +4,7 @@ 问卷调查_问卷页面 <%= stylesheet_link_tag 'polls', :media => 'all' %> + <%= javascript_heads %> @@ -33,20 +34,37 @@
+ <%= form_tag(commit_answer_poll_path(@poll),:remote => true,:id => 'form_'+ pq.id.to_s) do %> <% pq.poll_answers.each do |pa| %> <% end %>
+ <% end %>
<% elsif pq.question_type == 2 %> diff --git a/config/routes.rb b/config/routes.rb index af0b75ae7..931b9f919 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -62,6 +62,7 @@ RedmineApp::Application.routes.draw do member do get 'statistics_result' get 'add_mc' + post 'commit_answer' end end From d2fadfda085f17d35cad7c7787f52cf5e49060b6 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 15 Jan 2015 10:11:52 +0800 Subject: [PATCH 02/22] =?UTF-8?q?=E5=8D=95=E9=80=89=E9=A2=98=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=AD=94=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 8 ++++---- app/views/poll/show.html.erb | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index fcc1eef61..f83ff7cb9 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -113,11 +113,11 @@ class PollController < ApplicationController #提交答案 def commit_answer @pv = get_poll_vote(User.current.id,params[:poll_question_id]) - if params[:poll_vote][:poll_answer_id] - @pv.poll_answer_id = params[:poll_vote][:poll_answer_id] + if params[:poll_answer_id] + @pv.poll_answer_id = params[:poll_answer_id] end - if params[:poll_vote][:vote_text] - @pv.vote_text = params[:poll_vote][:vote_text] + if params[:vote_text] + @pv.vote_text = params[:vote_text] end @pv_saved = false if @pv.save diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 08dae18b2..86815f80a 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -42,21 +42,22 @@ From 20c160f03f5c633d45dd8c6363f27580ebbb21b8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 10:50:08 +0800 Subject: [PATCH 03/22] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=A4=B4=E3=80=81=E5=8F=96=E6=B6=88=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=A4=B4=E6=95=B0=E6=8D=AE=E7=9A=84=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=92=8C=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 8 ++++--- app/views/poll/_edit_head.html.erb | 36 +++++++++++++----------------- app/views/poll/_poll_form.html.erb | 10 ++++++++- app/views/poll/_show_head.html.erb | 12 +++++----- app/views/poll/update.js.erb | 1 + config/locales/zh.yml | 2 ++ 6 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 app/views/poll/update.js.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 52b4d8997..196b3c7ba 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -60,12 +60,14 @@ class PollController < ApplicationController end def update - @poll.polls_name = params[:polls_name] + @poll.polls_name = params[:polls_name].empty? ? l(:label_poll_title) : params[:polls_name] + @poll.polls_description = params[:polls_description].empty? ? l(:label_poll_description) : params[:polls_description] if @poll.save respond_to do |format| - format.html { redirect_to poll_index_url(:polls_type => @course.class.to_s, :polls_group_id => @course.id) } + format.js end else + render_404 end end @@ -98,7 +100,7 @@ class PollController < ApplicationController answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] question_option = { :answer_position => i, - :answer_text => params[:question_answer].values[i-1] + :answer_text => answer } @poll_questions.poll_answers.new question_option end diff --git a/app/views/poll/_edit_head.html.erb b/app/views/poll/_edit_head.html.erb index 759fe58a1..7662c12e0 100644 --- a/app/views/poll/_edit_head.html.erb +++ b/app/views/poll/_edit_head.html.erb @@ -1,21 +1,15 @@ - -
-
- -
-
- -
- -
-
\ No newline at end of file +<%= form_for @poll,:remote => true do |f|%> +
+
+ +
+
+ +
+ +
+
+<% end%> diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 473c1df83..474f3be29 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -10,6 +10,11 @@ function add_MCQ(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_MCQ') %>");} function add_single(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_single') %>");} function add_mulit(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_mulit') %>");} + //问卷头 + function pollsCancel() + { + $("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>"); + } //单选题 function add_single_answer(doc) { @@ -60,7 +65,10 @@
- <%= render :partial => 'edit_head'%> +
+ <%#= render :partial => 'show_head', :locals => {:poll => @poll} %> + <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> +
<% @poll.poll_questions.each do |poll_question|%> diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index f8a2d58f0..28741843d 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,8 +1,10 @@ -
-

标题标题标题标题标题标题标题

-

描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述 - 描述描述描述描述描述描述描述描述描述描述描述描述 -

+
+

+ <%= poll.polls_name%> +

+

+ <%= @poll.polls_description%> +

\ No newline at end of file diff --git a/app/views/poll/update.js.erb b/app/views/poll/update.js.erb new file mode 100644 index 000000000..e83b1b9f0 --- /dev/null +++ b/app/views/poll/update.js.erb @@ -0,0 +1 @@ +$("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>"); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9dae54818..95ab07d5d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2251,5 +2251,7 @@ zh: label_mulit: 多行文字 label_enter_single_title: 请输入单选题标题 label_new_answer: 新建选项 + label_poll_title: 问卷标题 + label_poll_description: 问卷描述 From 496ef94b97ac7073ec46159c9653ea96284165f1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 11:05:19 +0800 Subject: [PATCH 04/22] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=A4=B4=E9=A1=B5=E9=9D=A2js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll_form.html.erb | 9 +++------ app/views/poll/_show_head.html.erb | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 474f3be29..f32eabe8f 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -11,10 +11,8 @@ function add_single(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_single') %>");} function add_mulit(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_mulit') %>");} //问卷头 - function pollsCancel() - { - $("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>"); - } + function pollsCancel(){$("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>");} + function pollsEdit(){$("#polls_head").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:poll => @poll}) %>");} //单选题 function add_single_answer(doc) { @@ -66,8 +64,7 @@
- <%#= render :partial => 'show_head', :locals => {:poll => @poll} %> - <%= render :partial => 'edit_head', :locals => {:poll => @poll}%> + <%= render :partial => 'show_head', :locals => {:poll => @poll}%>
diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 28741843d..d279df64e 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,5 +1,5 @@
- +

<%= poll.polls_name%>

From d684acf5273c038cba31ac51c412e1cc93015952 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 15 Jan 2015 11:54:30 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E5=A4=9A=E9=80=89=E9=A2=98=E7=AD=94?= =?UTF-8?q?=E9=A2=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 51 ++++++++++++++++++++------ app/helpers/poll_helper.rb | 19 ++++------ app/views/poll/show.html.erb | 59 +++++++++++++++++++++--------- 3 files changed, 89 insertions(+), 40 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index f83ff7cb9..1f1f67ca9 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -112,22 +112,51 @@ class PollController < ApplicationController #提交答案 def commit_answer - @pv = get_poll_vote(User.current.id,params[:poll_question_id]) - if params[:poll_answer_id] - @pv.poll_answer_id = params[:poll_answer_id] - end - if params[:vote_text] - @pv.vote_text = params[:vote_text] - end - @pv_saved = false - if @pv.save - @pv_saved = true + pq = PollQuestion.find(params[:poll_question_id]) + if pq.question_type == 1 + #单选题 + pv = PollVote.find_by_poll_question_id_and_user_id(params[:poll_question_id],User.current.id) + if pv.nil? + pv = PollVote.new + pv.user_id = User.current.id + pv.poll_question_id = params[:poll_question_id] + end + pv.poll_answer_id = params[:poll_answer_id] + if pv.save + render :text => "ok" + else + render :text => "failure" + end + elsif pq.question_type == 2 + pv = PollVote.find_by_poll_answer_id_and_user_id(params[:poll_answer_id],User.current.id) + if pv.nil? + pv = PollVote.new + pv.user_id = User.current.id + pv.poll_question_id = params[:poll_question_id] + pv.poll_answer_id = params[:poll_answer_id] + if pv.save + render :text => "true" + else + render :text => "failure" + end + else + if pv.delete + render :text => "false" + else + render :text => "failure" + end + end + elsif pq.question_type == 3 + elsif pq.question_type == 4 + end + + #respond_to do |format| # format.js # format.json #end - render :text => "ok" + end private diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 202f33eaa..d612cbb97 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -18,18 +18,13 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module PollHelper - def get_poll_vote(user_id,poll_question_id) - pq = PollQuestion.find(poll_question_id) - if pq.question_type == 1 - pv = PollVote.find_by_poll_question_id_and_user_id(poll_question_id,user_id) - if pv.nil? - pv = PollVote.new - pv.user_id = user_id - pv.poll_question_id = poll_question_id - pv - else - pv - end + #判断选项是否被选中 + def answer_be_selected?(answer,user) + pv = answer.poll_votes.where("#{PollVote.table_name}.user_id = #{user.id} ") + if !pv.nil? && pv.count > 0 + true + else + false end end end \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 86815f80a..2dadbd2d3 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -34,7 +34,7 @@
- <%= form_tag(commit_answer_poll_path(@poll),:remote => true,:id => 'form_'+ pq.id.to_s) do %> +
<% pq.poll_answers.each do |pa| %> @@ -57,7 +57,7 @@ }); } - <%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;" %> + <%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current) %> <%= pa.answer_text %> @@ -65,7 +65,7 @@ <% end %>
- <% end %> +
<% elsif pq.question_type == 2 %> @@ -80,20 +80,45 @@
- - - <% pq.poll_answers.each do |pa| %> - - - - <% end %> - -
- -
+
+ + + <% pq.poll_answers.each do |pa| %> + + + + <% end %> + +
+ +
+
<% elsif pq.question_type == 3 %> From 517c3d1ca53ceff2006e9409c47f086f485b3b54 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 13:58:50 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E5=88=A0=E9=99=A4=E5=8D=95=E9=80=89?= =?UTF-8?q?=E9=A2=98=E9=A2=98=E9=80=89=E9=A1=B9=E5=90=8E=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E9=9D=A2=E5=86=8D=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=8D=95=E9=80=89?= =?UTF-8?q?=E9=A2=98=E4=B8=8E=E5=89=8D=E9=9D=A2=E5=8D=95=E9=80=89=E9=A2=98?= =?UTF-8?q?name=E6=9C=89=E9=87=8D=E5=A4=8D=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index f32eabe8f..d70829855 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -16,7 +16,7 @@ //单选题 function add_single_answer(doc) { - doc.parent().after("
  • " + + doc.parent().after("
  • " + ""+ "
  • "); } From 4996b9a54694797a320a84b17d14f7b0880e0f92 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 14:09:27 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=97=AE=E5=8D=B7=E5=A4=B4=E4=BC=9A=E4=BD=BF?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=A4=B4=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_edit_head.html.erb | 2 +- app/views/poll/_poll_form.html.erb | 10 +++++++--- app/views/poll/_show_head.html.erb | 4 ++-- app/views/poll/update.js.erb | 7 ++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/poll/_edit_head.html.erb b/app/views/poll/_edit_head.html.erb index 7662c12e0..ea36cbedf 100644 --- a/app/views/poll/_edit_head.html.erb +++ b/app/views/poll/_edit_head.html.erb @@ -4,7 +4,7 @@
    - +
    -
    + +
    <%= render :partial => 'show_head', :locals => {:poll => @poll}%>
    +
    <% @poll.poll_questions.each do |poll_question|%> diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index d279df64e..ce74dc10a 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,9 +1,9 @@
    -

    +

    <%= poll.polls_name%>

    -

    +

    <%= @poll.polls_description%>

    diff --git a/app/views/poll/update.js.erb b/app/views/poll/update.js.erb index e83b1b9f0..15d0fabd5 100644 --- a/app/views/poll/update.js.erb +++ b/app/views/poll/update.js.erb @@ -1 +1,6 @@ -$("#polls_head").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:poll => @poll}) %>"); \ No newline at end of file +$("#polls_title").val("<%= @poll.polls_name%>"); +$("#polls_description").val("<%= @poll.polls_description %>"); +$("#polls_name_h").html("<%= @poll.polls_name %>"); +$("#polls_description_p").html("<%= @poll.polls_description %>"); +$("#polls_head_edit").hide(); +$("#polls_head_show").show(); \ No newline at end of file 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 08/22] =?UTF-8?q?1=E3=80=81=E5=88=86=E7=A6=BB=E5=87=BA?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E9=97=AE=E5=8D=B7=E9=97=AE=E9=A2=98=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=202=E3=80=81=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E7=9B=B8=E5=85=B3=E8=B7=AF=E7=94=B1=E5=8F=8A?= =?UTF-8?q?action?= 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%>
    - + +
    - + <% elsif pq.question_type == 4 %>
  • @@ -149,7 +172,23 @@
  • - + +
    <%= get_anwser_vote_text(pq.id,User.current.id) %>
    @@ -163,7 +202,7 @@
    - 提交 + <%= link_to "提交",commit_poll_poll_path(@poll), :method => :post,:class => "ur_button",:format => 'js',:remote=>true %>
    答题已完成 0%
    diff --git a/config/routes.rb b/config/routes.rb index 28aa7452c..2f1414a48 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,6 +63,7 @@ RedmineApp::Application.routes.draw do get 'statistics_result' post 'commit_answer' post 'create_poll_question' + post 'commit_poll' end end From d55492b07a183410dbbc05f2d1e264e7fd047f22 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 15 Jan 2015 18:17:45 +0800 Subject: [PATCH 17/22] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8D=95=E9=80=89=E9=A2=98=E7=9A=84=E8=B7=AF=E7=94=B1=E3=80=81?= =?UTF-8?q?action=E3=80=81=E4=BB=A5=E5=8F=8Ajs?= 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 | 58 +++++++++++----------- app/views/poll/update_poll_question.js.erb | 0 config/routes.rb | 2 +- 4 files changed, 35 insertions(+), 32 deletions(-) create mode 100644 app/views/poll/update_poll_question.js.erb 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 From e44cc07f86af53431e890bd36e1442e695df4cba Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 15 Jan 2015 18:22:30 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 5 +++- app/views/poll/_commit_alert.html.erb | 37 +++++++++++++++++++++++++-- app/views/poll/commit_poll.js.erb | 7 +++-- app/views/poll/show.html.erb | 3 +++ 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 531cff906..cec9b3a34 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -180,9 +180,12 @@ class PollController < ApplicationController pu.poll_id = @poll.id if pu.save #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course') + @status = 0 #提交成功 + else + @status = 2 #未知错误 end else - + @status = 1 #有未做得必答题 end respond_to do |format| format.js diff --git a/app/views/poll/_commit_alert.html.erb b/app/views/poll/_commit_alert.html.erb index 007ae5ba7..46982006c 100644 --- a/app/views/poll/_commit_alert.html.erb +++ b/app/views/poll/_commit_alert.html.erb @@ -1,3 +1,36 @@ -
    - shaksdkfdks +
    + <% if status == 0 %> +

    提交成功!

    + <%= link_to "确定", poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course'),:style => 'height: 28px; +display: block; +width: 80px; +color: #fff; +background: #15bccf; +text-align: center; +padding-top: 4px; +float: left; +margin-right: 10px;'%> + <% elsif status == 1 %> +

    您还有尚未作答的题目请完成后在提交!

    + <%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:style => 'height: 28px; +display: block; +width: 80px; +color: #fff; +background: #15bccf; +text-align: center; +padding-top: 4px; +float: left; +margin-right: 10px;'%> + <% else %> +

    发生未知错误,请检查您的网络。

    + <%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:style => 'height: 28px; +display: block; +width: 80px; +color: #fff; +background: #15bccf; +text-align: center; +padding-top: 4px; +float: left; +margin-right: 10px;'%> + <% end %>
    diff --git a/app/views/poll/commit_poll.js.erb b/app/views/poll/commit_poll.js.erb index e0b9960b9..185967513 100644 --- a/app/views/poll/commit_poll.js.erb +++ b/app/views/poll/commit_poll.js.erb @@ -1,10 +1,9 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').css('height','200px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + +$('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); -$('#ajax-modal').parent().css("top","50%").css("left","20%"); -$('#ajax-modal').parent().css("position","absolute"); +$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/poll/show.html.erb b/app/views/poll/show.html.erb index 2db65ec97..4f9bc75aa 100644 --- a/app/views/poll/show.html.erb +++ b/app/views/poll/show.html.erb @@ -4,6 +4,9 @@ 问卷调查_问卷页面 <%= stylesheet_link_tag 'polls', :media => 'all' %> + - <%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current) %> + <%= radio_button "poll_vote","poll_answer_id",pa.id,:class=>"ur_radio",:onclick =>"click_#{pa.id}(this);return false;",:checked => answer_be_selected?(pa,User.current),:disabled => !@can_edit_poll %> <%= pa.answer_text %> @@ -130,7 +130,7 @@ }); } - > + <%= @can_edit_poll?"":"disabled=disabled" %> > <%= pa.answer_text %> @@ -171,7 +171,7 @@ } - + >
    <% elsif pq.question_type == 4 %> @@ -203,7 +203,7 @@ }); } -
    <%= get_anwser_vote_text(pq.id,User.current.id) %>
    +
    " onblur="onblur_<%= pq.id %>(this);"><%= get_anwser_vote_text(pq.id,User.current.id) %>
    diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css index 4c89f602d..e663e3c5e 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css @@ -1,160 +1,160 @@ -.overlay_mac_os_x_dialog { - background-color: #FF7224; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.mac_os_x_dialog_nw { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_n { - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; - height:18px; -} - -.mac_os_x_dialog_ne { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_w { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; -} - -.mac_os_x_dialog_e { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; - width:16px; -} - -.mac_os_x_dialog_sw { - background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_s { - background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; - height:40px; -} - -.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { - background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_sizer { - cursor:se-resize; -} - -.mac_os_x_dialog_close { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:25px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_minimize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:45px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_maximize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:65px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:12px; - text-align:center; - margin-top:6px; - width:100%; - color:#000; -} - -.mac_os_x_dialog_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; -} - -.mac_os_x_dialog_buttons { - text-align: center; -} -/* FOR IE */ -* html .mac_os_x_dialog_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - - -* html .mac_os_x_dialog_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - +.overlay_mac_os_x_dialog { + background-color: #FF7224; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.mac_os_x_dialog_nw { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_n { + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; + height:18px; +} + +.mac_os_x_dialog_ne { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_w { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; +} + +.mac_os_x_dialog_e { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; + width:16px; +} + +.mac_os_x_dialog_sw { + background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_s { + background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; + height:40px; +} + +.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { + background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_sizer { + cursor:se-resize; +} + +.mac_os_x_dialog_close { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:25px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_minimize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:45px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_maximize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:65px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:12px; + text-align:center; + margin-top:6px; + width:100%; + color:#000; +} + +.mac_os_x_dialog_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; +} + +.mac_os_x_dialog_buttons { + text-align: center; +} +/* FOR IE */ +* html .mac_os_x_dialog_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + + +* html .mac_os_x_dialog_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index b13cb1da2..e89e50be4 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -27,6 +27,7 @@ a.newbtn{ float:right; display:block; width:80px; height:30px; background:#64bdd a:hover.newbtn{ background:#55a1b9; text-decoration:none;} .polls_list ul{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:32px; padding-top:8px;} a.polls_title{ font-weight:bold; color:#3e6d8e;} +.polls_title{ font-weight:bold; color:#3e6d8e;} a.pollsbtn{ display:block; width:66px; height:22px; text-align:center; border:1px solid #64bdd9; color:#64bdd9;} a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} .polls_date{ color:#666666;} From 9fb0275563b12d3416662f35a7e9b71bbc478724 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 16 Jan 2015 10:43:05 +0800 Subject: [PATCH 22/22] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=8D=95=E9=80=89=E9=A2=98=E6=97=B6=E9=A1=B5=E9=9D=A2js?= =?UTF-8?q?=E7=9A=84=E5=88=B7=E6=96=B0=202.=E4=BF=AE=E6=94=B9=E5=8D=95?= =?UTF-8?q?=E9=80=89=E9=A2=98=E6=97=B6=E5=88=A0=E9=99=A4=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E9=80=89=E9=A1=B9=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 2 +- app/views/poll/_poll_question.html.erb | 12 ++++++++++++ app/views/poll/update_poll_question.js.erb | 8 ++++++-- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 app/views/poll/_poll_question.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 2f3c344cb..c82b9a385 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -122,7 +122,7 @@ class PollController < ApplicationController ################处理选项 if params[:question_answer] @poll_question.poll_answers.each do |answer| - @poll_question.poll_answers.destroy answer unless params[:question_answer].keys.include? answer.id.to_s + answer.destroy unless params[:question_answer].keys.include? answer.id.to_s end for i in 1..params[:question_answer].count question = @poll_question.poll_answers.find_by_id params[:question_answer].keys[i-1] diff --git a/app/views/poll/_poll_question.html.erb b/app/views/poll/_poll_question.html.erb new file mode 100644 index 000000000..7731c9821 --- /dev/null +++ b/app/views/poll/_poll_question.html.erb @@ -0,0 +1,12 @@ + +<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %> + + + + + +<% 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 index 267a27ae2..39d0fcfd6 100644 --- a/app/views/poll/update_poll_question.js.erb +++ b/app/views/poll/update_poll_question.js.erb @@ -1,2 +1,6 @@ - -pollQuestionCancel(<%= @poll_question.id%>); \ No newline at end of file +$("#poll_questions_<%= @poll_question.id%>").html("
    " + + "<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" + + "
    " + + "");