帖子列表中添加分页

This commit is contained in:
huang 2016-04-29 16:33:10 +08:00
parent 0bd34c2099
commit 253189ea7a
2 changed files with 28 additions and 1 deletions

View File

@ -50,10 +50,15 @@ class SubDocumentCommentsController < ApplicationController
def index
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@documents = @subdomain.sub_document_comments.where("parent_id is null").order("created_at desc")
@is_remote = true
@limit = 2
@atta_count = @documents.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@documents = paginateHelper @documents,2
respond_to do |format|
format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'}
end
else
render_403
end

View File

@ -14,6 +14,28 @@
</li>
<% end %>
</ul>
<div>
<ul class="wlist" id="pages" style="margin-top: 5px;">
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote %>
</ul>
</div>
<div class="sn-row sn-bg-white">
<div class="sn-wrap">
<ul class="sn-scroll sn-mb40">
<li class="sn-scroll-block sn-scroll-control">上一页</li>
<li class="sn-scroll-num sn-scroll-page">1</li>
<li class="sn-scroll-block sn-scroll-num">2</li>
<li class="sn-scroll-block sn-scroll-num">3</li>
<li class="sn-scroll-block sn-scroll-num">4</li>
<li class="sn-scroll-block sn-scroll-num">5</li>
<li class="sn-scroll-block sn-scroll-num">...</li>
<li class="sn-scroll-block sn-scroll-num">25</li>
<li class="sn-scroll-block sn-scroll-control">下一页</li>
</ul>
</div>
</div>
<div class="sn-inner-pages">
<a href="javascript:void()" class="sn-inner-pages-big" >上一页</a>
<a href="javascript:void()" class="sn-pages-active " >1</a>