From 7e8bcc55a11ab2fbdbf5dbba93e3cec6d072aafc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 20 Apr 2023 18:22:00 -0300 Subject: [PATCH] feat: indicar que se puede publicar el sitio #13178 --- app/models/site/build_stats.rb | 7 +++++++ app/views/sites/_status.haml | 2 ++ config/locales/en.yml | 1 + config/locales/es.yml | 1 + 4 files changed, 11 insertions(+) diff --git a/app/models/site/build_stats.rb b/app/models/site/build_stats.rb index 6eebcc84..64e689b6 100644 --- a/app/models/site/build_stats.rb +++ b/app/models/site/build_stats.rb @@ -40,6 +40,13 @@ class Site def not_published_yet? build_stats.jekyll.where(status: true).count.zero? end + + # Hubo cambios desde la última publicación? + # + # @return [Boolean] + def awaiting_publication? + updated_at > (build_stats.jekyll.where(status: true).last&.created_at || updated_at) + end end end end diff --git a/app/views/sites/_status.haml b/app/views/sites/_status.haml index a731aa7d..2d0de7b9 100644 --- a/app/views/sites/_status.haml +++ b/app/views/sites/_status.haml @@ -1,6 +1,8 @@ - link = nil - if site.not_published_yet? - message = t('.not_published_yet') +- elsif site.awaiting_publication? + - message = t('.awaiting_publication') - if site.building? - if site.average_publication_time_calculable? - average_building_time = site.average_publication_time diff --git a/config/locales/en.yml b/config/locales/en.yml index 3ddf681d..afb470c8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -365,6 +365,7 @@ en: building: "Your site is building, please wait to refresh this page..." not_published_yet: "Your site is being published for the first time, please wait up to 1 minute..." available: "Your site is available! Click here to visit it." + awaiting_publication: "There are unpublished changes. Click the button below and wait a moment to find them on your site." index: title: 'My Sites' pull: 'Upgrade' diff --git a/config/locales/es.yml b/config/locales/es.yml index 01f1085c..d80e2676 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -370,6 +370,7 @@ es: building: "Tu sitio se está publicando, por favor espera para recargar esta página..." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." available: "¡Tu sitio está disponible! Cliquea aquí para visitarlo." + awaiting_publication: "Hay cambios sin publicar, cliqueá el botón debajo y espera un momento para encontrarlos en tu sitio." index: title: 'Mis sitios' pull: 'Actualizar'