- Implemented a new admin panel that allows administrators to view statistics and manage weather art. The panel includes: - A card displaying total images and today's images - Buttons to generate new art and edit the city - Added `admin?` helper method to check if the current user is an administrator. - Updated database configuration to use safer credentials lookup method `dig` for development database URL instead of the previous method, improving reliability in accessing nested credentials.
29 lines
770 B
Ruby
29 lines
770 B
Ruby
module ApplicationHelper
|
|
def weather_art_schema(weather_art)
|
|
{
|
|
"@context": "https://schema.org",
|
|
"@type": "ImageObject",
|
|
"name": "#{weather_art.city.name} Weather Art",
|
|
"description": weather_art.description,
|
|
"datePublished": weather_art.created_at.iso8601,
|
|
"contentUrl": url_for(weather_art.image),
|
|
"author": {
|
|
"@type": "Organization",
|
|
"name": "TodayAIWeather"
|
|
},
|
|
"locationCreated": {
|
|
"@type": "Place",
|
|
"name": weather_art.city.name,
|
|
"address": {
|
|
"@type": "PostalAddress",
|
|
"addressCountry": weather_art.city.country.name
|
|
}
|
|
}
|
|
}.to_json.html_safe if weather_art.image.attached?
|
|
end
|
|
|
|
def admin?
|
|
current_user&.admin?
|
|
end
|
|
end
|