Cope with new installation without screenshots
This commit is contained in:
parent
ea3769501b
commit
0207cb194b
3 changed files with 12 additions and 13 deletions
|
|
@ -3,12 +3,11 @@ class WelcomeController < ApplicationController
|
||||||
# TODO: Only approved screenshots!
|
# TODO: Only approved screenshots!
|
||||||
@newest_upload = Screenshot.newest_upload
|
@newest_upload = Screenshot.newest_upload
|
||||||
|
|
||||||
# TODO: Use the actually most popular package and not just a random one
|
@most_popular_package = Package.with_screenshots.order(visits: :desc).first
|
||||||
@most_popular_package = Package.order(:visits).last
|
|
||||||
|
|
||||||
@package_count = Package.count
|
@package_count = Package.count
|
||||||
|
|
||||||
@most_wanted_package = Package.without_screenshots_most_visits.first
|
@most_wanted_package = Package.without_screenshots.order(visits: :desc).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def about
|
def about
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,6 @@ class Package < ApplicationRecord
|
||||||
where.not(id: subselect)
|
where.not(id: subselect)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Packages that need screenshots and have most visits.
|
|
||||||
# These packages are most likely to need a screenshot.
|
|
||||||
def self.without_screenshots_most_visits
|
|
||||||
self.without_screenshots.order(visits: :desc)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Return a query of all approved/public screenshots of this package
|
# Return a query of all approved/public screenshots of this package
|
||||||
def screenshots_approved
|
def screenshots_approved
|
||||||
self.screenshots.where(approved: true)
|
self.screenshots.where(approved: true)
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,11 @@
|
||||||
.large-3.medium-12.small-12.cell.text-center
|
.large-3.medium-12.small-12.cell.text-center
|
||||||
h2 Most popular
|
h2 Most popular
|
||||||
.thumb-height
|
.thumb-height
|
||||||
a href=package_path(@most_popular_package.name)
|
- if @most_popular_package
|
||||||
img src=@most_popular_package.screenshots.first.image.url(:thumb, timestamp: false)
|
a href=package_path(@most_popular_package.name)
|
||||||
|
img src=@most_popular_package.screenshots.first.image.url(:thumb, timestamp: false)
|
||||||
|
- else
|
||||||
|
'No uploaded screenshots yet.
|
||||||
p
|
p
|
||||||
strong
|
strong
|
||||||
=@most_popular_package.name
|
=@most_popular_package.name
|
||||||
|
|
@ -49,8 +52,11 @@
|
||||||
.large-3.medium-12.small-12.cell.text-center
|
.large-3.medium-12.small-12.cell.text-center
|
||||||
h2 Contribute
|
h2 Contribute
|
||||||
.thumb-height
|
.thumb-height
|
||||||
a href=upload_path(@most_wanted_package.name)
|
- if @most_wanted_package.name
|
||||||
img src="/images/dummy/no-screenshots-upload-one.svg" width="160"
|
a href=upload_path(@most_wanted_package.name)
|
||||||
|
img src="/images/dummy/no-screenshots-upload-one.svg" width="160"
|
||||||
|
- else
|
||||||
|
'No uploaded screenshots yet.
|
||||||
p
|
p
|
||||||
/ TODO: Randomly choose one of ~30 packages
|
/ TODO: Randomly choose one of ~30 packages
|
||||||
' We lack a screenshot for the
|
' We lack a screenshot for the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue