Pagination fixed
This commit is contained in:
parent
3ad1dc605b
commit
6ddf9ff48c
2 changed files with 10 additions and 25 deletions
|
|
@ -24,14 +24,7 @@ class PackagesController < ApplicationController
|
|||
# first image twice as large. So the first page contains 5 images while
|
||||
# the second and further page contain 6 images.
|
||||
@page = params[:page]
|
||||
# BUG: having page 1 with 5 and other with 6 items does not compute correctly
|
||||
@images_per_page = if @page.to_i < 2
|
||||
5
|
||||
else
|
||||
6
|
||||
end
|
||||
# raise
|
||||
@screenshots = screenshots_visible_to_user(@package).paginate(page: @page, per_page: @images_per_page)
|
||||
@screenshots = screenshots_visible_to_user(@package).paginate(page: @page, per_page: 6)
|
||||
end
|
||||
|
||||
# Show upload form for new images
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue