Added package pagination using kaminari
This commit is contained in:
parent
8a0a8d7577
commit
35510212ba
4 changed files with 11 additions and 2 deletions
3
Gemfile
3
Gemfile
|
|
@ -57,3 +57,6 @@ end
|
|||
|
||||
# Twitter Bootstrap template
|
||||
gem 'bootstrap-sass'
|
||||
|
||||
# Pagination
|
||||
gem 'kaminari'
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ GEM
|
|||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.0)
|
||||
kaminari (0.14.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
|
|
@ -132,6 +135,7 @@ DEPENDENCIES
|
|||
coffee-rails (~> 4.0.0)
|
||||
jbuilder (~> 1.2)
|
||||
jquery-rails
|
||||
kaminari
|
||||
meta_request
|
||||
pg
|
||||
rails (= 4.0.0)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ class PackagesController < ApplicationController
|
|||
@packages = @packages.includes(:screenshots).where("screenshots.approved"=>true)
|
||||
end
|
||||
|
||||
@packages = @packages.limit(20)
|
||||
#@packages = @packages.limit(20)
|
||||
@packages = @packages.page(params[:page]).per(12)
|
||||
end
|
||||
|
||||
def with_screenshots
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<% # Show search results %>
|
||||
|
||||
<% if @packages.length>0 %>
|
||||
<%= paginate @packages %>
|
||||
<ul class="thumbnails">
|
||||
<% @packages.each do |package| %>
|
||||
<li class="span3">
|
||||
|
|
@ -26,4 +27,4 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
|
||||
<button class="btn btn-large btn-block" type="button">More screenshots…</button>
|
||||
<!--<button class="btn btn-large btn-block" type="button">More screenshots…</button>-->
|
||||
Loading…
Add table
Add a link
Reference in a new issue