From d97bbdab1d7f3258ae6df092adc89986c796d3ff Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 3 Jul 2023 14:21:48 +0200
Subject: [PATCH] Fix #1103

---
 app/views/admin/layouts/themes/_pure.html.erb | 10 +---------
 .../themes/pure/_user_unconfirmed.html.erb    | 20 +++++++++++++++++++
 config/locales/en.yml                         |  2 +-
 config/locales/fr.yml                         |  2 +-
 4 files changed, 23 insertions(+), 11 deletions(-)
 create mode 100644 app/views/admin/layouts/themes/pure/_user_unconfirmed.html.erb

diff --git a/app/views/admin/layouts/themes/_pure.html.erb b/app/views/admin/layouts/themes/_pure.html.erb
index b6e54cbba..347aaf379 100644
--- a/app/views/admin/layouts/themes/_pure.html.erb
+++ b/app/views/admin/layouts/themes/_pure.html.erb
@@ -3,15 +3,7 @@
   <%= render "admin/layouts/themes/pure/hero" %>
   <%= render 'application/notice' %>
   <main class="container-fluid">
-    <% unless current_user.confirmed? %>
-      <div class="alert alert-warning">
-        <div class="alert-message">
-          <%= t('admin.users_alerts.pending_confirmation_html', duration: distance_of_time_in_words(Rails.configuration.devise.allow_unconfirmed_access_for)) %>
-          <br>
-          <%= link_to t('devise.confirmations.new.resend_confirmation_instructions'), resend_user_confirmation_path, method: :post, class: 'alert-link' %>
-        </div>
-      </div>
-    <% end %>
+    <%= render "admin/layouts/themes/pure/user_unconfirmed" %>
     <div class="position-relative">
       <%= yield %>
     </div>
diff --git a/app/views/admin/layouts/themes/pure/_user_unconfirmed.html.erb b/app/views/admin/layouts/themes/pure/_user_unconfirmed.html.erb
new file mode 100644
index 000000000..4cbdf225a
--- /dev/null
+++ b/app/views/admin/layouts/themes/pure/_user_unconfirmed.html.erb
@@ -0,0 +1,20 @@
+<% unless current_user.confirmed? %>
+  <div class="row">
+    <div class="col-xl-6">
+      <div class="alert alert-warning mb-4">
+        <div class="alert-message">
+          <%= t('admin.users_alerts.pending_confirmation_html', 
+                  duration: distance_of_time_in_words(
+                    Rails.configuration.devise.allow_unconfirmed_access_for
+                  )
+                ) %>
+          <br>
+          <%= link_to t('devise.confirmations.new.resend_confirmation_instructions'), 
+                      resend_user_confirmation_path, 
+                      method: :post, 
+                      class: 'alert-link' %>
+        </div>
+      </div>
+    </div>
+  </div>
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a17fc0017..c2342f788 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -130,7 +130,7 @@ en:
     users_alerts:
       already_confirmed: "Your account has already been confirmed."
       not_locked_html: '<i>%{model}</i> was not locked.'
-      pending_confirmation_html: "Your account has not been <b>confirmed</b> yet.<br>You have received an e-mail with a confirmation link. If you don't confirm, your account will stop working after <b>%{duration}</b>."
+      pending_confirmation_html: "Your account has not been <b>confirmed</b> yet. You have received an e-mail with a confirmation link. If you don't confirm, your account will stop working after <b>%{duration}</b>."
       successfully_unlocked_html: "<i>%{model}</i> was successfully unlocked."
     will_be_published_html: "<i>%{model}</i> will soon be published."
   batch_selectable:
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 1844ef2ec..1c6bb55a1 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -130,7 +130,7 @@ fr:
     users_alerts:
       already_confirmed: "Votre compte est déjà confirmé."
       not_locked_html: "<i>%{model}</i> n'était pas verrouillé(e)."
-      pending_confirmation_html: "Votre compte n'a pas encore été <b>confirmé</b>.<br>Vous avez reçu un e-mail contenant un lien de confirmation. En l'absence de confirmation, votre compte cessera de fonctionner après <b>%{duration}</b>."
+      pending_confirmation_html: "Votre compte n'a pas encore été <b>confirmé</b>. Vous avez reçu un e-mail contenant un lien de confirmation. En l'absence de confirmation, votre compte cessera de fonctionner après <b>%{duration}</b>."
       successfully_unlocked_html: "<i>%{model}</i> a bien été déverrouillé(e)."
     will_be_published_html: "<i>%{model}</i> va bientôt être publié(e)."
   batch_selectable:
-- 
GitLab