增加应用列表页面的分页功能
This commit is contained in:
parent
12ad20cf3b
commit
0403666cea
|
@ -7,7 +7,14 @@ class SoftapplicationsController < ApplicationController
|
|||
# GET /softapplications.json
|
||||
def index
|
||||
@softapplications = Softapplication.all
|
||||
|
||||
@limit = 5
|
||||
#new added
|
||||
@softapplication_count = @softapplications.count
|
||||
@softapplication_pages = Paginator.new @softapplication_count, @limit, params['page']
|
||||
@offset ||= @softapplication_pages.offset
|
||||
@softapplications = @softapplications[@offset,@limit]
|
||||
#new added end
|
||||
#@softapplications = @softapplications[@offset,@limit]
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @softapplications }
|
||||
|
|
|
@ -59,11 +59,12 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pagination"><%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
|
||||
<div class="pagination"><%= pagination_links_full @softapplication_pages, @softapplication_count, :per_page_links => false %></div>
|
||||
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul>
|
||||
<%#= pagination_links_full @softapplications %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% html_title l(:label_softapplication_list)%>
|
Loading…
Reference in New Issue