style: update layout of city show view

- Change stats div to be responsive
- Adjust coordinates display format for better readability

This update enhances the layout of the city show view by making
it more responsive and improving the display of weather and
geographical data. Additionally, the startup task for
refreshing the sitemap is now consistently executed,
removing unnecessary complexity.
This commit is contained in:
songtianlun 2025-01-25 10:51:14 +08:00
parent c37a93bcdf
commit 742c94ced1
2 changed files with 5 additions and 20 deletions

View File

@ -27,7 +27,7 @@
</div> </div>
</div> </div>
<div class="stats bg-base-100/80 backdrop-blur-sm shadow-lg rounded-box"> <div class="stats stats-vertical sm:stats-horizontal bg-base-100/80 backdrop-blur-sm shadow-lg rounded-box w-full sm:w-auto">
<div class="stat"> <div class="stat">
<div class="stat-title">Latest Weather</div> <div class="stat-title">Latest Weather</div>
<div class="stat-value text-2xl"> <div class="stat-value text-2xl">
@ -40,7 +40,7 @@
<div class="stat"> <div class="stat">
<div class="stat-title">Coordinates</div> <div class="stat-title">Coordinates</div>
<div class="stat-value text-xl"> <div class="stat-value text-xl">
<%= @city.latitude %>°N, <%= @city.longitude %>°E <%= @city.latitude %>°N,<br class="sm:hidden"> <%= @city.longitude %>°E
</div> </div>
<div class="stat-desc">Geographical Location</div> <div class="stat-desc">Geographical Location</div>
</div> </div>
@ -50,6 +50,8 @@
<div class="stat-desc">Total Entries</div> <div class="stat-desc">Total Entries</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,21 +1,4 @@
# config/initializers/schedule_tasks.rb # config/initializers/schedule_tasks.rb
Rails.application.config.after_initialize do Rails.application.config.after_initialize do
if Rails.env.production? && !ENV["RAILS_BUILD"] RefreshSitemapWorker.perform_async
begin
redis_key = "startup_task_running"
unless Sidekiq.redis { |conn| conn.get(redis_key) }
Sidekiq.redis do |conn|
conn.setex(redis_key, 1.hour.to_i, "1")
end
RefreshSitemapWorker.perform_async
Rails.logger.info "Startup task (RefreshSitemapWorker) scheduled successfully"
end
rescue => e
Rails.logger.error "Error scheduling startup task: #{e.message}"
ensure
Sidekiq.redis { |conn| conn.del(redis_key) }
end
end
end end