Skip to content

Commit

Permalink
Merge pull request olivierlacan#4 from stmichael/paging_support
Browse files Browse the repository at this point in the history
Pagination for gif index page
  • Loading branch information
olivierlacan committed Sep 10, 2012
2 parents 31fdcfa + 15a9660 commit 7eb4e79
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ gem 'haml-rails'
gem 'simple_form'
gem 'jquery-rails'
gem 'rails_tokeninput'
gem 'will_paginate'

gem 'unicorn'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
will_paginate (3.0.3)

PLATFORMS
ruby
Expand All @@ -144,3 +145,4 @@ DEPENDENCIES
simple_form
uglifier (>= 1.0.3)
unicorn
will_paginate
2 changes: 1 addition & 1 deletion app/controllers/gifs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class GifsController < ApplicationController
respond_to :html, :json

def index
respond_with @gifs = Gif.all
respond_with @gifs = Gif.paginate(:page => params[:page], :per_page => 20)
end

def show
Expand Down
2 changes: 2 additions & 0 deletions app/views/gifs/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
= f.input :tag_tokens, label: "Keywords" #, input_html: { data: {load: Tag.all} }
= f.submit

= will_paginate @gifs

- unless @gifs.empty?
%ul#gif-list
- @gifs.reverse_each do |gif|
Expand Down

0 comments on commit 7eb4e79

Please sign in to comment.