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();" %> + + 取  消 + +
+
+
+ + +