From 282501c845850b81b9662fd6a9148f464d76e68e 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 4cf480df..425b0471 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 46f64ee9..41db7ba9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -364,6 +364,7 @@ en: building: "Your site is building, refresh this page in ." 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 find all the different ways 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 81c0b463..f53b6103 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -369,6 +369,7 @@ es: building: "Tu sitio se está publicando, recargá esta página en ." not_published_yet: "Tu sitio se está publicando por primera vez, por favor espera hasta un minuto..." available: "¡Tu sitio está disponible! Cliqueá aquí para encontrar todas las formas en que podés 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'