From 0cf5838658042a9ab9cdf0664148eb946e8471d9 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Fri, 31 May 2024 16:29:20 +0200
Subject: [PATCH] Footer

---
 .../stylesheets/admin/pure/navigation.sass    |  2 +
 app/assets/stylesheets/admin/pure/style.sass  |  7 ++-
 .../admin/application_controller.rb           |  5 ++
 app/controllers/admin/dashboard_controller.rb |  1 -
 app/views/admin/dashboard/index.html.erb      | 15 ------
 .../layouts/themes/pure/_footer.html.erb      | 51 +++++++++++--------
 .../admin/layouts/themes/pure/_hero.html.erb  |  8 ++-
 config/locales/en.yml                         |  7 ++-
 config/locales/fr.yml                         |  7 ++-
 9 files changed, 56 insertions(+), 47 deletions(-)

diff --git a/app/assets/stylesheets/admin/pure/navigation.sass b/app/assets/stylesheets/admin/pure/navigation.sass
index ce8874603..99e22c94a 100644
--- a/app/assets/stylesheets/admin/pure/navigation.sass
+++ b/app/assets/stylesheets/admin/pure/navigation.sass
@@ -57,6 +57,8 @@ nav[aria-label="breadcrumb"]
     .breadcrumb
         align-items: center
         flex-wrap: nowrap
+        *
+            color: $color-text-alt !important
         .breadcrumb-item
             flex-shrink: 0
             white-space: nowrap
diff --git a/app/assets/stylesheets/admin/pure/style.sass b/app/assets/stylesheets/admin/pure/style.sass
index 34627c185..dca0dfb18 100644
--- a/app/assets/stylesheets/admin/pure/style.sass
+++ b/app/assets/stylesheets/admin/pure/style.sass
@@ -34,10 +34,9 @@ h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1
     margin-bottom: 30px
     min-height: 300px
     padding-bottom: 30px
-    .breadcrumb
-        *
-            color: $color-text-alt !important
-
+    .welcome
+        color: $color-text-alt
+        font-size: px2rem(14)
 main
     min-height: 70vh
     padding-bottom: px2rem(100)
diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb
index 5a98ff54f..119a0c694 100644
--- a/app/controllers/admin/application_controller.rb
+++ b/app/controllers/admin/application_controller.rb
@@ -11,6 +11,11 @@ class Admin::ApplicationController < ApplicationController
     redirect_to admin_root_path
   end
 
+  def background_tasks_count
+    @background_tasks_count ||= GoodJob::Job.where(finished_at: nil).count
+  end
+  helper_method :background_tasks_count
+
   protected
 
   def breadcrumb
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb
index 59689f3f9..dd170122f 100644
--- a/app/controllers/admin/dashboard_controller.rb
+++ b/app/controllers/admin/dashboard_controller.rb
@@ -5,7 +5,6 @@ class Admin::DashboardController < Admin::ApplicationController
     @namespaces << Research if feature_research?
     @namespaces << Communication if feature_communication?
     @namespaces << Administration if feature_administration?
-    @background_tasks_count = GoodJob::Job.running.count + GoodJob::Job.queued.count + GoodJob::Job.retried.count
     breadcrumb
   end
 end
diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb
index 6f25cb8b1..4796cd9f8 100644
--- a/app/views/admin/dashboard/index.html.erb
+++ b/app/views/admin/dashboard/index.html.erb
@@ -8,21 +8,6 @@
   <% end %>
 <% end %>
 
-<% classes = 'col-md-6 col-xl-4 d-flex' %>
-<div class="row mb-5">
-  <div class="col-md-6 pb-4">
-    <%= osuny_panel t('hello', name: current_user.first_name) do %>
-    <% end %>
-  </div>
-  <div class="col-md-6 pb-4">
-    <%= osuny_panel @background_tasks_count, 
-              action: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock align-baseline"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>' do %>
-      <p class="mb-0"><%= t('admin.pending_tasks.label') %></p>
-      <p class="mb-0 small"><%= t('admin.pending_tasks.hint') %></p>
-    <% end %>
-  </div>
-</div>
-
 <%= render 'admin/application/favorites/show' %>
 
 <% if current_university.is_really_a_university %>
diff --git a/app/views/admin/layouts/themes/pure/_footer.html.erb b/app/views/admin/layouts/themes/pure/_footer.html.erb
index 6da60fb7a..265664283 100644
--- a/app/views/admin/layouts/themes/pure/_footer.html.erb
+++ b/app/views/admin/layouts/themes/pure/_footer.html.erb
@@ -1,28 +1,35 @@
-<footer class="bg-black py-5">
+<footer class="bg-black text-white py-5">
   <div class="container-fluid">
-    <div class="row">
-      <div class="col-md-3">
-        <%= link_to 'https://www.osuny.org', target: :_blank do %>
-          <%= image_tag 'osuny-white.svg', width: 100 %>
-        <% end %>
+    <div class="row my-5 pb-5">
+      <div class="offset-lg-1 col-lg-5 pb-4 backgroundTasks__count">
+        <p class="text-white"><%= t('admin.pending_tasks.tasks') %></p>
+        <div class="display-5 text-serif"><%= background_tasks_count %></div>
       </div>
-      <div class="col-md-9 text-md-end small">
-        <ul class="list-inline">
-          <%
-            [
-              ['Aide à la contribution', 'https://support.osuny.org'],
-              ['Aide au code', 'https://developers.osuny.org'],
-              ['Site d\'exemple', 'https://example.osuny.org'],
-              ['Thème Figma', 'https://www.figma.com/community/file/1176490763864113451'],
-              ['Statut', 'https://status.osuny.org'],
-            ].each do |item| 
-          %>
-            <li class="list-inline-item">
-              <%= link_to item.first, item.last, target: :_blank %>
-            </li>
-          <% end %>
-        </ul>
+      <div class="col-lg-5 pb-4">
+        <p class="text-white-50 text-uppercase"><%= t('admin.pending_tasks.what_is_it') %></p>
+        <p class="text-white"><%= t('admin.pending_tasks.text_html') %></p>
       </div>
     </div>
+
+    <div class="d-flex justify-content-between mt-5 pt-5">
+      <%= link_to 'https://www.osuny.org', target: :_blank, class: 'text-white-50' do %>
+        <%= t('admin.footer.signature') %>
+      <% end %>
+      <ul class="list-inline">
+        <%
+          [
+            ['Aide à la contribution', 'https://support.osuny.org'],
+            ['Aide au code', 'https://developers.osuny.org'],
+            ['Site d\'exemple', 'https://example.osuny.org'],
+            ['Thème Figma', 'https://www.figma.com/community/file/1176490763864113451'],
+            ['Statut', 'https://status.osuny.org'],
+          ].each do |item| 
+        %>
+          <li class="list-inline-item">
+            <%= link_to item.first, item.last, target: :_blank, class: 'text-white-50' %>
+          </li>
+        <% end %>
+      </ul>
+    </div>
   </div>
 </footer>
\ No newline at end of file
diff --git a/app/views/admin/layouts/themes/pure/_hero.html.erb b/app/views/admin/layouts/themes/pure/_hero.html.erb
index c65b71d8a..855f0f44a 100644
--- a/app/views/admin/layouts/themes/pure/_hero.html.erb
+++ b/app/views/admin/layouts/themes/pure/_hero.html.erb
@@ -1,6 +1,12 @@
 <div class="hero">
   <div class="container-fluid">
-    <%= render_breadcrumbs builder: Osuny::BreadcrumbsOnRailsBuilder %>
+    <% if controller_name == 'dashboard' && action_name == 'index' %>
+      <div class="welcome py-4">
+        <%= t('hello', name: current_user.first_name) %>
+      </div>
+    <% else %>
+      <%= render_breadcrumbs builder: Osuny::BreadcrumbsOnRailsBuilder %>
+    <% end %>
     <div class="d-xl-flex mt-5">
       <h1><%= yield :title %></h1>
       <div class="ms-xl-auto text-xl-end mt-2">
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5978c5cd1..2e0973716 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -121,6 +121,8 @@ en:
       zero: No element
       one: 1 element
       other: "%{count} elements"
+    footer:
+      signature: Osuny, a public interest digital common
     i18n:
       in: in %{lang}
       switch_to: switch to %{choices}
@@ -133,8 +135,9 @@ en:
       hint: Plain text without HTML, dedicated to Search Engine Optimization (SEO).
       label: Meta description
     pending_tasks:
-      label: Background tasks pending
-      hint: Those tasks precompute your data in order to minimize its carbon footprint. It creates a delay before your changes are online.
+      tasks: Background tasks pending
+      text_html: "Osuny can help you achieve digital sobriety.<br><br>The background execution of most tasks on the Osuny platform helps to reduce the carbon footprint of digital technology, by pre-calculating what can be.<br><br>This can cause a delay before your changes are visible on your websites."
+      what_is_it: What is it?
     password_hint: Leave blank if you do not wish to change the password.
     seo: SEO
     successfully_created_html: "<i>%{model}</i> was successfully created."
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 08418f20c..2f90461a3 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -121,6 +121,8 @@ fr:
       zero: Aucun élément
       one: 1 élément
       other: "%{count} éléments"
+    footer:
+      signature: Osuny, un commun numérique d’intérêt général
     i18n:
       in: en %{lang}
       switch_to: basculer en %{choices}
@@ -133,8 +135,9 @@ fr:
       hint: Texte simple, dédié au à l'optimisation pour les moteurs de recherche (Search Engine Optimization, SEO).
       label: Meta description
     pending_tasks:
-      label: Tâches en cours de traitement
-      hint: L'exécution de ces tâches contribue à diminuer l'empreinte carbone du numérique, en précalculant ce qui peut l'être. Cela peut générer un délai avant que vos modifications ne soient visibles.
+      tasks: Tâches en cours de traitement
+      text_html: "Osuny vous accompagne dans la sobriété numérique.<br><br>L'exécution mutualisée de toutes les tâches de la plateforme Osuny contribue à diminuer l'empreinte carbone du numérique, en précalculant ce qui peut l'être.<br><br>Cela peut générer un délai avant que vos modifications ne soient visibles sur vos sites internets."
+      what_is_it: Qu'est-ce que c'est ?
     password_hint: Laissez vide si vous ne souhaitez pas modifier le mot de passe.
     seo: SEO
     successfully_created_html: "<i>%{model}</i> a bien été créé(e)."
-- 
GitLab