1.增加老师和学生显示界面的区别

2.增加分页的动态显示,以及分页相关css修改
This commit is contained in:
sw 2015-01-13 11:44:28 +08:00
parent 32219bd850
commit a18fa10de5
3 changed files with 20 additions and 18 deletions

View File

@ -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

View File

@ -24,13 +24,17 @@
</a>
</li>
<li>
<a href="#" class="pollsbtn fl ml10">
<%= l(:label_statistical_results)%>
</a>
<%if @is_teacher%>
<a href="#" class="pollsbtn fl ml10">
<%= l(:label_statistical_results)%>
</a>
<% end%>
</li>
<li>
<%= 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%>
</li>
<li class="polls_date fr">
<%= format_time poll.created_at%>
@ -39,12 +43,8 @@
<div class="cl"></div>
<% end%>
<ul class="wlist" style=" border:none;">
<li><a href="#">下一页</a></li>
<li><a href="#">...</a></li>
<li><a href="#">2</a></li>
<li class="wlist_select" ><a href="#">1</a></li>
<li><a href="#">上一页</a></li>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->

View File

@ -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;}