Added pagination of screenshots to reduce loading times

This commit is contained in:
Christoph Haas 2020-10-25 02:21:12 +02:00
parent f323f94582
commit 77d8daedea
4 changed files with 47 additions and 20 deletions

View file

@ -10,14 +10,14 @@
.grid-x.grid-margin-x
.small-7.medium-7.cell
/ Left column contains images
- if screenshots_visible_to_user(@package).count > 0
- if @screenshots.count > 0
.grid-x.grid-margin-y.grid-margin-x.align-middle
- screenshots_visible_to_user(@package).each_with_index do |screenshot, idx|
/ Display the first screenshot as a large image
- if idx==0
/ TODO: paginator at the top looks ugly. maybe more space? or put it into the box on the right?
= render(partial: 'packages/paginator', locals: {items: @screenshots})
- @screenshots.each_with_index do |screenshot, idx|
/ Display the first screenshot as a large image (on the first page only)
- if idx==0 && @page.to_i<2
.small-12.medium-12.cell
.margin-bottom-3
= render(partial:'medium_image', locals: {screenshot: screenshot})

View file

@ -2,7 +2,7 @@
.grid-x
.small-6.medium-8.large-9.cell
// Paginator
= render 'packages/paginator'
= render(partial: 'packages/paginator', locals: {items: @packages})
.small-6.medium-4.large-3.cell
// Search form
@ -21,7 +21,7 @@
= render 'packages/noresults'
// Paginator
= render 'packages/paginator'
= render(partial: 'packages/paginator', locals: {items: @packages})
// Icon sidebar for options and views
.small-3.large-2.cell