From 57e03a1efd9c4cd192cade469464feb3c008acfd Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 16 Nov 2023 16:53:15 +0100
Subject: [PATCH] simplification

---
 .../meta_description/_show.html.erb           |   2 +-
 .../university/people/_main_infos.html.erb    | 178 ++++++++++--------
 2 files changed, 101 insertions(+), 79 deletions(-)

diff --git a/app/views/admin/application/meta_description/_show.html.erb b/app/views/admin/application/meta_description/_show.html.erb
index d69a0ec4d..30453cec8 100644
--- a/app/views/admin/application/meta_description/_show.html.erb
+++ b/app/views/admin/application/meta_description/_show.html.erb
@@ -1,4 +1,4 @@
-<%= osuny_panel t('seo') do %>
+<%= osuny_panel t('seo'), small: true do %>
   <%= osuny_label t('admin.meta_description.label') %>
   <p><%= sanitize about.meta_description %></p>
 <% end unless about.meta_description.blank? %>
diff --git a/app/views/admin/university/people/_main_infos.html.erb b/app/views/admin/university/people/_main_infos.html.erb
index 7ed090dd8..475f57b97 100644
--- a/app/views/admin/university/people/_main_infos.html.erb
+++ b/app/views/admin/university/people/_main_infos.html.erb
@@ -1,72 +1,8 @@
 <div class="row">
-  <div class="col-md-8 col-xl-9">
-    <div class="row">
-      <div class="col-lg-4">
-        <%= osuny_panel t('content'), small: true do %>
-          <div class="row pure__row--small">
-            <% unless person.gender.blank? %>
-              <%= osuny_label University::Person.human_attribute_name('gender') %>
-              <p><%= t("activerecord.attributes.university/person.genders.#{person.gender}") %></p>
-            <% end %>
-            <% unless person.email.blank? %>
-              <%= osuny_label University::Person.human_attribute_name('email') %>
-              <p><%= link_to person.email, "mailto:#{person.email}", target: '_blank' %></p>
-            <% end %>
-            <% ['phone_mobile', 'phone_personal', 'phone_professional'].each do |phone| %>
-              <% unless person[phone].blank? %>
-                <%= osuny_label University::Person.human_attribute_name(phone) %>
-                <p><%= link_to person[phone], "tel:#{person[phone]}", target: '_blank' %></p>
-              <% end %>
-            <% end %>
-            <% unless person.birthdate.blank? %>
-              <%= osuny_label University::Person.human_attribute_name('birthdate') %>
-              <p><%= l(person.birthdate, format: :birthday) %></p>
-            <% end %>
-            <% [:address, :zipcode, :city].each do |property| %>
-              <% value = person.send property %>
-              <% next if value.blank? %>
-              <%= osuny_label University::Person.human_attribute_name(property) %>
-              <p><%= value %></p>
-            <% end %>
-            <% if person.country.present? %>
-              <%= osuny_label University::Person.human_attribute_name(:country) %>
-              <p><%= person.country_name %></p>
-            <% end %>
-          </div>
-        <% end %>      
-      </div>
-      <div class="col-lg-8">
-        <%= render 'admin/application/summary/show', about: person, small: true %>
-        <% unless person.biography.blank? %>
-          <%= osuny_label University::Person.human_attribute_name('biography') %>
-          <%= sanitize person.biography %>
-        <% end %>
-      </div>
-    </div>
+  <div class="col-md-4">
 
-    <%= osuny_panel University::Person.human_attribute_name('socials') do %>
-      <% unless person.url.blank? %>
-        <%= osuny_label University::Person.human_attribute_name('url') %>
-        <p><%= link_to person.url, person.url, target: '_blank' %></p>
-      <% end %>
-      <% unless person.linkedin.blank? %>
-        <%= osuny_label University::Person.human_attribute_name('linkedin') %>
-        <p><%= link_to person.linkedin, person.linkedin, target: '_blank' %></p>
-      <% end %>
-      <% unless person.twitter.blank? %>
-        <%= osuny_label University::Person.human_attribute_name('twitter') %>
-        <p><%= link_to person.twitter, "https://twitter.com/#{person.twitter}", target: '_blank' %></p>
-      <% end %>
-      <% unless person.mastodon.blank? %>
-        <%= osuny_label University::Person.human_attribute_name('mastodon') %>
-        <p><%= link_to person.mastodon, person.mastodon, target: '_blank' %></p>
-      <% end %>
-    <% end unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? %>
-
-    <%= render 'admin/communication/blocks/content/editor', about: person %>
-  </div>
-  <div class="col-md-4 col-xl-3">
-    <%= osuny_panel t('activerecord.attributes.university/person.picture') do %>
+    <%= osuny_panel t('activerecord.attributes.university/person.picture'), small: true do %>
+      <%= kamifusen_tag person.best_picture, class: 'img-fluid col-4 col-md-8' %>
       <% if person.best_picture_inherits_from_user? %>
         <p>
           <span class="small text-muted">
@@ -74,18 +10,10 @@
           </span>
         </p>
       <% end %>
-      <%= kamifusen_tag person.best_picture, class: 'img-fluid' %>
     <% end if person.best_picture.attached? %>
-    <%= osuny_panel t('metadata') do %>
-        <%= osuny_label University::Person.human_attribute_name('slug') %>
-        <p><%= person.slug %></p>
-        <% if person.user.present? %>
-          <%= osuny_label University::Person.human_attribute_name('user') %>
-          <p><%= link_to_if can?(:read, person.user), person.user, admin_user_path(person.user) %></p>
-        <% end %>
-    <% end %>
+
     <% if person.categories.any? %>
-      <%= osuny_panel University::Person.human_attribute_name('categories') do %>
+      <%= osuny_panel University::Person.human_attribute_name('categories'), small: true do %>
         <ul class="list-unstyled">
           <% person.categories.ordered.each do |category| %>
             <li><%= link_to_if can?(:read, category), category, [:admin, category] %></li>
@@ -93,8 +21,102 @@
         </ul>
       <% end %>
     <% end %>
-    <%= render 'admin/application/i18n/widget', about: person %>
+
+    <%= render 'admin/application/i18n/widget', about: person, small: true %>
 
     <%= render 'admin/application/meta_description/show', about: person %>
   </div>
+  <div class="col-md-8">
+
+    <%= render 'admin/application/summary/show', about: person, small: true %>
+
+    <% unless person.biography.blank? %>
+      <%= osuny_panel University::Person.human_attribute_name('biography'), small: true do %>
+        <%= sanitize person.biography %>
+      <% end %>
+    <% end %>
+
+    <%= osuny_panel University::Person.human_attribute_name('contacts'), small: true do %>
+      <div class="row">
+        <% if person.user.present? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('user') %>
+            <p><%= link_to_if can?(:read, person.user), person.user, admin_user_path(person.user) %></p>
+          </div>
+        <% end %>
+        <% unless person.gender.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('gender') %>
+            <p><%= t("activerecord.attributes.university/person.genders.#{person.gender}") %></p>
+          </div>
+        <% end %>
+        <% unless person.email.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('email') %>
+            <p><%= link_to person.email, "mailto:#{person.email}", target: '_blank' %></p>
+          </div>
+        <% end %>
+        <% ['phone_mobile', 'phone_personal', 'phone_professional'].each do |phone| %>
+          <% unless person[phone].blank? %>
+            <div class="col-md-6">
+              <%= osuny_label University::Person.human_attribute_name(phone) %>
+              <p><%= link_to person[phone], "tel:#{person[phone]}", target: '_blank' %></p>
+            </div>
+          <% end %>
+        <% end %>
+        <% unless person.birthdate.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('birthdate') %>
+            <p><%= l(person.birthdate, format: :birthday) %></p>
+          </div>
+        <% end %>
+        <% [:address, :zipcode, :city].each do |property| %>
+          <% value = person.send property %>
+          <% next if value.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name(property) %>
+            <p><%= value %></p>
+          </div>
+        <% end %>
+        <% if person.country.present? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name(:country) %>
+            <p><%= person.country_name %></p>
+          </div>
+        <% end %>
+      </div>
+    <% end %>
+
+    <%= osuny_panel University::Person.human_attribute_name('socials'), small: true do %>
+      <div class="row">
+        <% unless person.url.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('url') %>
+            <p><%= link_to person.url, person.url, target: '_blank' %></p>
+          </div>
+        <% end %>
+        <% unless person.linkedin.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('linkedin') %>
+            <p><%= link_to person.linkedin, person.linkedin, target: '_blank' %></p>
+          </div>
+        <% end %>
+        <% unless person.twitter.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('twitter') %>
+            <p><%= link_to person.twitter, "https://twitter.com/#{person.twitter}", target: '_blank' %></p>
+          </div>
+        <% end %>
+        <% unless person.mastodon.blank? %>
+          <div class="col-md-6">
+            <%= osuny_label University::Person.human_attribute_name('mastodon') %>
+            <p><%= link_to person.mastodon, person.mastodon, target: '_blank' %></p>
+          </div>
+        <% end %>
+      </div>
+    <% end unless person.url.blank? && person.linkedin.blank? && person.twitter.blank? && person.mastodon.blank? %>
+
+  </div>
 </div>
+
+<%= render 'admin/communication/blocks/content/editor', about: person %>
-- 
GitLab