From ae9856c01a1c42d71c3507f27d8ced7707c039ec Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 16 Jan 2015 17:21:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=97=B6=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E6=A1=86js=E3=80=81css=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 10 +++-- app/views/poll/_poll_form.html.erb | 14 ++++++- app/views/poll/_poll_submit.html.erb | 63 ++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 app/views/poll/_poll_submit.html.erb diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index cbd8fb12d..6a4ba0cc5 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,8 +1,8 @@ class PollController < ApplicationController - before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer] + before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll] 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] + before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll] include PollHelper def index if @course @@ -180,7 +180,11 @@ class PollController < ApplicationController #发布问卷 def publish_poll - + @poll.polls_status = 2 + @poll.published_at = Time.now + if @poll.save + redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) + end end #提交答案 diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 1b30c973d..849ae7774 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -54,6 +54,18 @@ doc.parent().remove(); } } + + function poll_submit() + { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'poll_submit', locals: { poll: @poll}) %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').css('height','180px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } @@ -104,7 +116,7 @@
- + <%= l(:label_memo_create)%>
diff --git a/app/views/poll/_poll_submit.html.erb b/app/views/poll/_poll_submit.html.erb new file mode 100644 index 000000000..0f9e96b73 --- /dev/null +++ b/app/views/poll/_poll_submit.html.erb @@ -0,0 +1,63 @@ + + + + 开启匿评功能 + + + + + + +
+
+

问卷发布

+

+ 问卷发布后将无法 + 修改 +
+ 是否确定发布该问卷? +

+
+ <%= link_to "确 定",publish_poll_poll_path(poll.id), :class => "tijiao", :onclick => "clickCanel();" %> + + 取  消 + +
+
+
+ + +