From 43ae5142420896c1abaf5ab2f7b3885a6d24bcb3 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sat, 12 Apr 2025 15:28:47 +0800 Subject: [PATCH] refactor: update weather art descriptions - Change description to use @weather_art.prompt instead of a translated string with multiple parameters. - Update image_alt method to include the prompt in the descriptive text. These changes simplify the metadata generation for weather art and improve the clarity of the image descriptions by incorporating the prompt, which may provide users with additional context. --- app/controllers/weather_arts_controller.rb | 9 +++++---- app/models/weather_art.rb | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/weather_arts_controller.rb b/app/controllers/weather_arts_controller.rb index 3a2df34..0a620aa 100644 --- a/app/controllers/weather_arts_controller.rb +++ b/app/controllers/weather_arts_controller.rb @@ -21,10 +21,11 @@ class WeatherArtsController < ApplicationController title: t("meta.weather_arts.show.title", city_name: @city.name, date: formatted_date), - description: t("meta.weather_arts.show.description", - city_name: @city.name, - description: @weather_art.description, - temperature: @weather_art.temperature), + description: @weather_art.prompt, + # description: t("meta.weather_arts.show.description", + # city_name: @city.name, + # description: @weather_art.description, + # temperature: @weather_art.temperature), keywords: t("meta.weather_arts.show.keywords", city_name: @city.name, country_name: @city.country.name, diff --git a/app/models/weather_art.rb b/app/models/weather_art.rb index e311aeb..72e1fa7 100644 --- a/app/models/weather_art.rb +++ b/app/models/weather_art.rb @@ -168,7 +168,7 @@ class WeatherArt < ApplicationRecord end def image_alt - "#{self.city.full_name} Weather Art - #{self.description} at #{self.temperature}°C on #{self.formatted_time(:date)}" + "#{self.city.full_name} Weather Art - #{self.description} at #{self.temperature}°C on #{self.formatted_time(:date)}, #{self.prompt}" end private