diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 78babc43c..1d7b4117d 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -214,6 +214,7 @@ class PollController < ApplicationController def publish_poll @poll.polls_status = 2 @poll.published_at = Time.now + @poll.show_result = params[:show_result] if @poll.save if params[:is_remote] redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index e6b667075..e08b13033 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -315,7 +315,11 @@ function insert_MCQ(quest_type,quest_num,quest_id){ alert("问卷标题不能为空"); } else{ - $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false}) %>'); + if($("#show_result").is(":checked")) { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 1}) %>'); + } else{ + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { :poll => @poll,:is_remote => false,:show_result=> 0}) %>'); + } showModal('ajax-modal', '310px'); $('#ajax-modal').css('height','120px'); $('#ajax-modal').siblings().remove(); @@ -377,7 +381,7 @@ function insert_MCQ(quest_type,quest_num,quest_id){ <%= l(:label_memo_create)%>