From 61cad639a6c7d0869c2bb4618e585b298e0883fc Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Wed, 24 Aug 2016 22:41:50 +0200 Subject: [PATCH] Showing most wanted package on home page properly --- app/controllers/welcome_controller.rb | 4 ++-- app/views/welcome/home.slim | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 38af1ba..c598fd5 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -4,11 +4,11 @@ class WelcomeController < ApplicationController @newest_upload = Screenshot.newest_upload # TODO: Use the actually most popular package and not just a random one - @most_popular_package = Package.with_screenshots.first + @most_popular_package = Package.order(:visits).last @package_count = Package.count - @most_wanted = Package.without_screenshots_most_visits.first + @most_wanted_package = Package.without_screenshots_most_visits.first end def about diff --git a/app/views/welcome/home.slim b/app/views/welcome/home.slim index 4922e70..af1785a 100644 --- a/app/views/welcome/home.slim +++ b/app/views/welcome/home.slim @@ -24,8 +24,6 @@ div.row hr - -div.row div.large-4.medium-12.small-12.columns.text-center h2 Newest upload // TODO: load actual newest upload and cache it @@ -53,9 +51,9 @@ div.row div.large-4.medium-12.small-12.columns.text-center h2 Your help needed // TODO: load actual most popular package without a screenshot and cache it - a href=upload_package_by_name_path('firefox') + a href=upload_package_by_name_path(@most_wanted_package.name) img src="/images/dummy/no-screenshots-upload-one.svg" width="80%" p - ' We lack a screenshot for the Firefox package. Can you - a href=upload_package_by_name_path('firefox') provide one + ' We lack a screenshot for the #{@most_wanted_package.name} package. Can you + a href=package_path(@most_wanted_package.name) provide one ' ?