Pagination fixed

This commit is contained in:
Christoph Haas 2020-11-01 23:26:04 +01:00
parent 3ad1dc605b
commit 6ddf9ff48c
2 changed files with 10 additions and 25 deletions

View file

@ -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