diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index cb01c573e..d4e2517e7 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -6,8 +6,9 @@ class PollController < ApplicationController def index if @course - @is_teacher = User.current.allowed_to?(:as_teacher,course) - @polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}") + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}") + @polls = paginateHelper polls,10 #分页 respond_to do |format| format.html{render :layout => 'base_courses'} end @@ -95,6 +96,6 @@ class PollController < ApplicationController end def is_course_teacher - render_403 unless(@course && User.current.allowed_to?(:as_teacher,course)) + render_403 unless(@course && User.current.allowed_to?(:as_teacher,@course)) end end \ No newline at end of file diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index 39230774b..fc36a8abf 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -24,13 +24,17 @@
  • - - <%= l(:label_statistical_results)%> - + <%if @is_teacher%> + + <%= l(:label_statistical_results)%> + + <% end%>
  • - <%= link_to(l(:button_delete), poll, - method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %> + <% if @is_teacher%> + <%= link_to(l(:button_delete), poll, + method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml20 mr10") %> + <% end%>
  • <%= format_time poll.created_at%> @@ -39,12 +43,8 @@
    <% end%> -