refactor: prioritize latest arts over featured

- Comment out featured arts in home controller
- Update index.html.erb to display latest arts instead of featured

This change aims to keep the displayed arts up-to-date and fresh by showing the latest ones, enhancing user experience by providing more current content.
This commit is contained in:
songtianlun 2025-02-16 01:14:25 +08:00
parent 0af41e24a8
commit 6f2a42b92b
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@ class HomeController < ApplicationController
@popular_arts = WeatherArt.includes(:city, :image_attachment).by_popularity(3)
# @random_arts = WeatherArt.includes(:city, :image_attachment).random(3)
@latest_arts = WeatherArt.includes(:city, :image_attachment).latest(6)
@featured_arts = WeatherArt.includes(:city, :image_attachment).order(created_at: :desc).limit(5)
# @featured_arts = WeatherArt.includes(:city, :image_attachment).order(created_at: :desc).limit(5)
set_meta_tags(
title: "AI-Generated Weather Art",
description: "Experience weather through artistic AI visualization. Daily updated weather art for cities worldwide.",

View File

@ -1,9 +1,9 @@
<div>
<!-- 首屏展示区 -->
<section class="h-screen-90 relative overflow-hidden">
<% if @featured_arts.first&.image&.attached? %>
<% if @latest_arts.first&.image&.attached? %>
<div class="absolute inset-0">
<%= image_tag @featured_arts.first.preview_image(:large).processed, class: "w-full h-full object-cover" %>
<%= image_tag @latest_arts.first.preview_image(:large).processed, class: "w-full h-full object-cover" %>
<div class="absolute inset-0 bg-gradient-to-r from-base-100/90 to-base-100/50"></div>
</div>
<% end %>