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' %> +