From f836eb0f37d5022a633a5cfa93b870c067575347 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Thu, 19 May 2022 17:45:30 +0200
Subject: [PATCH] show alumni

---
 .../admin/university/alumni/show.html.erb     | 19 +++++++++++++++++++
 .../extranet/organizations/show.html.erb      |  2 +-
 app/views/extranet/persons/show.html.erb      |  2 +-
 config/locales/en.yml                         |  1 +
 config/locales/fr.yml                         |  1 +
 config/locales/university/en.yml              |  1 -
 config/locales/university/fr.yml              |  1 -
 7 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/app/views/admin/university/alumni/show.html.erb b/app/views/admin/university/alumni/show.html.erb
index 83ad9faef..1fc61fa85 100644
--- a/app/views/admin/university/alumni/show.html.erb
+++ b/app/views/admin/university/alumni/show.html.erb
@@ -17,6 +17,25 @@
   </div>
 <% end %>
 
+<% if @alumnus.experiences.any? %>
+  <div class="card flex-fill w-100">
+    <div class="card-header">
+      <h2 class="card-title mb-0 h5"><%= University::Person::Experience.model_name.human(count: @alumnus.experiences.count) %></h2>
+    </div>
+    <div class="card-body">
+      <ul class="list-unstyled">
+      <% @alumnus.experiences.ordered.each do |experience| %>
+        <% organization = experience.organization %>
+        <li>
+          <%= link_to_if can?('read', organization), organization, [:admin, organization] %>
+          <%= "(#{experience.from_year} - #{experience.to_year.present? ? experience.to_year : t('today')})" %>
+        </li>
+      <% end %>
+      </ul>
+    </div>
+  </div>
+<% end %>
+
 
 <% content_for :action_bar_right do %>
   <%= edit_link @alumnus %>
diff --git a/app/views/extranet/organizations/show.html.erb b/app/views/extranet/organizations/show.html.erb
index c1a410e21..67d044f7d 100644
--- a/app/views/extranet/organizations/show.html.erb
+++ b/app/views/extranet/organizations/show.html.erb
@@ -42,7 +42,7 @@
                   <%= experience.description %><br>
                 <% end %>
                 <%= "#{experience.from_year} —" if experience.from_year %>
-                <%= experience.to_year || University::Person::Experience.human_attribute_name(:today) %>
+                <%= experience.to_year || t('today') %>
               </p>
             </div>
           </li>
diff --git a/app/views/extranet/persons/show.html.erb b/app/views/extranet/persons/show.html.erb
index d40ac0236..a6901c294 100644
--- a/app/views/extranet/persons/show.html.erb
+++ b/app/views/extranet/persons/show.html.erb
@@ -30,7 +30,7 @@
                 <p><b><%= experience.description %></b></p>
                 <p class="mb-0">
                   <%= "#{experience.from_year} —" if experience.from_year %>
-                  <%= experience.to_year || University::Person::Experience.human_attribute_name(:today) %>
+                  <%= experience.to_year || t('today') %>
                 </p>
               </div>
               <div>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a24c9010c..f4364a70e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -184,6 +184,7 @@ en:
       date_only: "%m/%d/%Y"
       date_with_explicit_month: "%B %d, %Y"
       date_with_hour: "%B %d, %Y %H:%M"
+  today: Today
   true: Yes
   unsplash:
     next: Next image
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index a03167dfd..623e0d9cd 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -184,6 +184,7 @@ fr:
       date_only: "%d/%m/%Y"
       date_with_explicit_month: "%d %B %Y"
       date_with_hour: "%d %B %Y %H:%M"
+  today: Aujourd'hui
   true: Oui
   unsplash:
     next: Images suivantes
diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml
index 7b1e4780f..b61aa453c 100644
--- a/config/locales/university/en.yml
+++ b/config/locales/university/en.yml
@@ -57,7 +57,6 @@ en:
       university/person/experience:
         from_year: Start year
         to_year: End year
-        today: Today
       university/person/involvement:
         description: Mission (in this context)
         person: Person
diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml
index 502fa6a92..c04e730f0 100644
--- a/config/locales/university/fr.yml
+++ b/config/locales/university/fr.yml
@@ -57,7 +57,6 @@ fr:
       university/person/experience:
         from_year: Année de début
         to_year: Année de fin
-        today: Aujourd'hui
       university/person/involvement:
         description: Mission (dans ce contexte)
         person: Personne
-- 
GitLab