导入问卷后进入问卷再回退,再点击该问卷,页面报404

This commit is contained in:
cxt 2016-10-24 17:35:06 +08:00
parent cfeece0c76
commit c962e3c18b
2 changed files with 11 additions and 11 deletions

View File

@ -574,16 +574,17 @@ class PollController < ApplicationController
end
@poll.save
end
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,20 #分页
respond_to do |format|
format.js
end
redirect_to poll_index_path(:polls_type => "Course", :polls_group_id => @course.id)
# @is_teacher = User.current.allowed_to?(:as_teacher,@course)
# if @is_teacher
# polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
# else
# polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
# end
# @polls = paginateHelper polls,20 #分页
# respond_to do |format|
# format.js
# end
end
private

View File

@ -5,7 +5,6 @@
<div id="error_show" style="color: red;"></div>
<%= form_tag import_other_poll_poll_index_path,
method: :post,
remote: true,
id: "relation_file_form" do %>
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>