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%>
-
- - 下一页
- - ...
- - 2
- - 1
- - 上一页
+
+ <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css
index c83ef6833..494d9cb60 100644
--- a/public/stylesheets/polls.css
+++ b/public/stylesheets/polls.css
@@ -27,10 +27,11 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;}
.polls_date{ color:#666666;}
.polls_de{ color:#6883b6;}
/****翻页***/
-.wlist{}
-.wlist a{ float:right; border:1px solid #64bdd9; padding:0 5px; margin-left:3px; color:#64bdd9;}
-.wlist a:hover{border:1px solid #64bdd9; background-color:#64bdd9; color:#fff; text-decoration:none;}
-.wlist_select a { background-color:#48aac9; color:#fff;}
+ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
+ul.wlist li{float: left;}
+ul.wlist li a{ border:1px solid #15bccf; padding:4px; margin-left:3px;}
+ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
+.wlist_select { background-color:#64bdd9; color:#fff; padding:0 5px; margin-left:3px;margin-top: -2px; border:1px solid #64bdd9;}
/*问卷页面*/
.polls_box{ border:1px solid #dcdcdc; padding:15px 30px;}