From e53e4a59467368fe797d4a05a01dee5394659064 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Mon, 24 Oct 2022 11:48:09 +0200
Subject: [PATCH] better

---
 .../extranet/pages/_experience.sass           |  4 --
 .../extranet/pages/_experiences.sass          |  3 ++
 .../extranet/pages/_organization.sass         | 20 --------
 .../stylesheets/extranet/pages/_person.sass   | 46 -----------------
 app/views/extranet/account/show.html.erb      | 22 +++-----
 .../extranet/experiences/_experience.html.erb | 31 ++++++-----
 app/views/extranet/experiences/_list.html.erb | 12 +++++
 .../extranet/organizations/show.html.erb      |  6 +--
 .../extranet/personal_data/edit.html.erb      | 51 ++++++++++---------
 app/views/extranet/persons/show.html.erb      | 14 ++---
 config/locales/extranet/en.yml                |  4 +-
 config/locales/extranet/fr.yml                |  4 +-
 12 files changed, 75 insertions(+), 142 deletions(-)
 delete mode 100644 app/assets/stylesheets/extranet/pages/_experience.sass
 create mode 100644 app/assets/stylesheets/extranet/pages/_experiences.sass
 create mode 100644 app/views/extranet/experiences/_list.html.erb

diff --git a/app/assets/stylesheets/extranet/pages/_experience.sass b/app/assets/stylesheets/extranet/pages/_experience.sass
deleted file mode 100644
index b2d812352..000000000
--- a/app/assets/stylesheets/extranet/pages/_experience.sass
+++ /dev/null
@@ -1,4 +0,0 @@
-.experience
-    &__company
-        &__logo
-            max-width: 100px
\ No newline at end of file
diff --git a/app/assets/stylesheets/extranet/pages/_experiences.sass b/app/assets/stylesheets/extranet/pages/_experiences.sass
new file mode 100644
index 000000000..44f23b193
--- /dev/null
+++ b/app/assets/stylesheets/extranet/pages/_experiences.sass
@@ -0,0 +1,3 @@
+.experiences
+    &__experience
+        @include pseudo-bottom-border
\ No newline at end of file
diff --git a/app/assets/stylesheets/extranet/pages/_organization.sass b/app/assets/stylesheets/extranet/pages/_organization.sass
index d245d3537..29662cfd7 100644
--- a/app/assets/stylesheets/extranet/pages/_organization.sass
+++ b/app/assets/stylesheets/extranet/pages/_organization.sass
@@ -19,23 +19,3 @@
         align-items: center
         display: flex
         justify-content: space-between
-        
-.organizations-show
-    .experiences
-        margin-top: px2rem(80)
-        ul
-            padding-left: 0
-            li
-                @include make-row
-                display: flex
-                position: relative
-                > div
-                    @include make-col-ready
-                    &:nth-child(1)
-                        width: percentage(2/9)
-                    &:nth-child(2)
-                        @include pseudo-bottom-border
-                        @include pseudo-top-border
-                        padding-top: px2rem(20)
-                        width: percentage(7/9)
-
diff --git a/app/assets/stylesheets/extranet/pages/_person.sass b/app/assets/stylesheets/extranet/pages/_person.sass
index bca155082..0656f586e 100644
--- a/app/assets/stylesheets/extranet/pages/_person.sass
+++ b/app/assets/stylesheets/extranet/pages/_person.sass
@@ -5,49 +5,3 @@
         &__portrait
             margin-top: -200px
             margin-bottom: 50px
-
-.persons-show,
-.account-show
-    .top
-        h1
-            font-weight: normal
-        @include media-breakpoint-down(md)
-            header
-                border-bottom: 0
-    .experiences
-        margin-top: px2rem(70)
-        ul
-            padding-left: 0
-            li
-                @include make-row
-                @include pseudo-top-border
-                display: flex
-                padding: px2rem(16) 0
-                position: relative
-                p
-                    margin-bottom: px2rem(8)
-                > div
-                    @include make-col-ready
-                    padding-bottom: px2rem(10)
-                    padding-top: px2rem(10)
-                    &:nth-child(3)
-                        align-self: center
-                        padding-bottom: 0
-                        padding-top: 0
-                        text-align: right
-                    @include media-breakpoint-up(md)
-                        &:nth-child(1)
-                            width: percentage(4/9)
-                        &:nth-child(2)
-                            width: percentage(2/9)
-                        &:nth-child(3)
-                            width: percentage(3/9)
-                    @include media-breakpoint-down(md)
-                        &:nth-child(2)
-                            width: 50%
-                        &:nth-child(3)
-                            width: 50%
-                &:last-child
-                    @include pseudo-bottom-border
-                img
-                    max-height: 80px
\ No newline at end of file
diff --git a/app/views/extranet/account/show.html.erb b/app/views/extranet/account/show.html.erb
index 300e2ed2c..e13e2c8a7 100644
--- a/app/views/extranet/account/show.html.erb
+++ b/app/views/extranet/account/show.html.erb
@@ -2,28 +2,18 @@
 
 <div class="row">
   <div class="col-md-9">
-    <div class="biography">
+    <div class="biography mb-5">
       <p><%= @person&.biography %></p>
     </div>
 
-    <div class="experiences">
-      <%= link_to University::Person::Experience.human_attribute_name('new'),
-                  new_experience_path,
-                  class: 'btn btn-sm btn-secondary float-end mb-4' %>
-      <p class="mb-4"><%= t('extranet.experiences.title') %></p>
-      <br>
-      <% if @person&.experiences.any? %>
-        <ul>
-          <% @person.experiences.ordered.each do |experience| %>
-            <%= render 'extranet/experiences/experience', experience: experience, edit: true %>
-          <% end %>
-        </ul>
-        <% end %>
-    </div>
+    <%= link_to University::Person::Experience.human_attribute_name('new'),
+                new_experience_path,
+                class: 'btn btn-sm btn-secondary float-end' %>
+    <p><%= t('extranet.experiences.title') %></p>
+    <%= render 'extranet/experiences/list', person: @person, edit: true %>
   </div>
   <div class="col-md-3">
     <%= kamifusen_tag @person.best_picture, width: 400, class: 'img-fluid person__portrait' if @person&.best_picture.attached? %>
-
     <div class="mb-4">
       <%= link_to t('extranet.account.edit'), edit_account_path, class: 'btn btn-primary mb-2' %>
       <%= link_to t('extranet.account.edit_personal_data'), edit_personal_data_path, class: 'btn btn-primary' %>
diff --git a/app/views/extranet/experiences/_experience.html.erb b/app/views/extranet/experiences/_experience.html.erb
index a51fc5b7b..92ffc5d8d 100644
--- a/app/views/extranet/experiences/_experience.html.erb
+++ b/app/views/extranet/experiences/_experience.html.erb
@@ -1,32 +1,31 @@
 <%
 edit ||= false
 %>
-<li>
-  <div>
+<li class="experiences__experience row py-3">
+  <div class="col-md-4">
     <p><b><%= experience.description %></b></p>
     <p class="mb-0">
       <%= "#{experience.from_year} —" if experience.from_year %>
       <%= experience.to_year || t('today') %>
     </p>
+
+    <%= link_to University::Person::Experience.human_attribute_name('edit'),
+                edit_experience_path(experience),
+                class: 'btn btn-sm btn-secondary mt-2' if edit %>
   </div>
-  <div>
-    <% if experience.organization.present? %>
+  <% if experience.organization.present? %>
+    <div class="col-md-6">
       <p><%= link_to experience.organization, experience.organization %></p>
       <% if experience.organization.url %>
         <p class="mb-0"><small><%= link_to experience.organization.url, experience.organization.url %></small></p>
       <% end %>
-    <% end %>
-  </div>
-  <div class="experience__company">
-    <% if experience.organization.present? %>
+    </div>
+    <div class="col-md-2">
       <% if experience.organization.logo.attached? %>
-          <%= link_to experience.organization do %>
-            <%= kamifusen_tag experience.organization.logo, height: 80, class: 'img-fluid experience__company__logo' %>
-          <% end %>
+        <%= link_to experience.organization do %>
+          <%= kamifusen_tag experience.organization.logo, height: 80, class: 'img-fluid' %>
+        <% end %>
       <% end %>
-    <% end %>
-  </div>
-  <%= link_to University::Person::Experience.human_attribute_name('edit'),
-              edit_experience_path(experience),
-              class: 'btn btn-sm btn-secondary float-end mt-2' if edit %>
+    <div>
+  <% end %>
 </li>
diff --git a/app/views/extranet/experiences/_list.html.erb b/app/views/extranet/experiences/_list.html.erb
new file mode 100644
index 000000000..ae422741e
--- /dev/null
+++ b/app/views/extranet/experiences/_list.html.erb
@@ -0,0 +1,12 @@
+<%
+edit ||= false
+%>
+<% if person&.experiences.any? %>
+  <div class="experiences mt-4">
+    <ul class="list-unstyled">
+      <% @person.experiences.ordered.each do |experience| %>
+        <%= render 'extranet/experiences/experience', experience: experience, edit: edit %>
+      <% end %>
+    </ul>
+  </div>
+<% end %>
\ No newline at end of file
diff --git a/app/views/extranet/organizations/show.html.erb b/app/views/extranet/organizations/show.html.erb
index 5a7bda812..e7fa87f23 100644
--- a/app/views/extranet/organizations/show.html.erb
+++ b/app/views/extranet/organizations/show.html.erb
@@ -2,16 +2,16 @@
 
 <div class="row">
   <div class="col-md-9">
-    <div class="biography">
+    <div class="biography mb-5">
       <p><%= @organization.text %></p>
     </div>
     <div class="experiences">
       <p class="mb-4"><%= t('extranet.organization.experiences', count: @organization.experiences.count) %></p>
-      <ul>
+      <ul class="list-unstyled">
           <% @organization.experiences.ordered.each do |experience| %>
           <li class="mb-3">
             <div>
-              <%= link_to experience.person, class: "stretched-link" do %>
+              <%= link_to experience.person do %>
                 <% if experience.person.picture.attached? %>
                   <%= kamifusen_tag experience.person.picture, width: 200, class: 'img-fluid' %>
                 <% else %>
diff --git a/app/views/extranet/personal_data/edit.html.erb b/app/views/extranet/personal_data/edit.html.erb
index cd5d4cdcd..2188965b6 100644
--- a/app/views/extranet/personal_data/edit.html.erb
+++ b/app/views/extranet/personal_data/edit.html.erb
@@ -4,53 +4,58 @@
   <%= f.error_notification %>
   <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %>
 
-  <h5><%= University::Person.human_attribute_name('essentials') %></h5>
+  <h2 class="h5 mt-5">
+    <%= University::Person.human_attribute_name('essentials') %>
+  </h2>
 
   <div class="row">
-    <div class="col-md-6">
+    <div class="col-md-4">
       <%= f.input :gender, label_method: lambda { |g| t("activerecord.attributes.university/person.genders.#{g[1]}") } %>
-    </div>
-    <div class="col-md-6">
       <%= f.input :birthdate, discard_year: true, include_blank: true %>
     </div>
+    <div class="col-md-8">
+      <%= f.input :biography, as: :summernote %>
+    </div>
   </div>
-  <%= f.input :description_short %>
-  <%= f.input :biography, as: :summernote %>
 
-  <h5><%= University::Person.human_attribute_name('contacts') %></h5>
+  <h2 class="h5 mt-5">
+    <%= University::Person.human_attribute_name('contacts') %>
+  </h2>
 
   <div class="row">
     <div class="col-md-4">
       <%= f.input :phone_mobile %>
-    </div>
-    <div class="col-md-4">
       <%= f.input :phone_professional %>
-    </div>
-    <div class="col-md-4">
       <%= f.input :phone_personal %>
     </div>
-  </div>
-  <div class="row">
-    <div class="col-md-6">
+    <div class="col-md-8">
       <%= f.input :address %>
-    </div>
-    <div class="col-md-6">
-      <%= f.input :zipcode %>
+      <div class="row">
+        <div class="col-md-4">
+          <%= f.input :zipcode %>
+        </div>
+        <div class="col-md-8">
+          <%= f.input :city %>
+        </div>
+      </div>
+      <%= f.input :country, input_html: { class: 'form-select' } %>
     </div>
   </div>
   <div class="row">
     <div class="col-md-6">
-      <%= f.input :city %>
-    </div>
-    <div class="col-md-6">
-      <%= f.input :country, input_html: { class: 'form-select' } %>
     </div>
   </div>
+  <div class="row">
+  </div>
 
-  <h5><%= University::Person.human_attribute_name('socials') %></h5>
+  <h2 class="h5 mt-5">
+    <%= University::Person.human_attribute_name('socials') %>
+  </h2>
 
-  <%= f.input :url %>
   <div class="row">
+    <div class="col-md-6">
+      <%= f.input :url %>
+    </div>
     <div class="col-md-6">
       <%= f.input :linkedin %>
     </div>
diff --git a/app/views/extranet/persons/show.html.erb b/app/views/extranet/persons/show.html.erb
index f9ef0205f..6608ebc0a 100644
--- a/app/views/extranet/persons/show.html.erb
+++ b/app/views/extranet/persons/show.html.erb
@@ -5,16 +5,10 @@
     <div class="biography">
       <p><%= @person&.biography %></p>
     </div>
-    <% if @person&.experiences.any? %>
-      <div class="experiences">
-        <p class="mb-4"><%= t('extranet.experiences.title') %></p>
-        <ul>
-          <% @person.experiences.ordered.each do |experience| %>
-            <%= render 'extranet/experiences/experience', experience: experience %>
-          <% end %>
-        </ul>
-      </div>
-    <% end %>
+
+    <p class="mb-4"><%= t('extranet.experiences.title') %></p>
+    <%= render 'extranet/experiences/list', person: @person %>
+
   </div>
   <div class="col-md-3">
     <%= kamifusen_tag @person.best_picture, width: 400, class: 'img-fluid person__portrait' if @person.best_picture.attached? %>
diff --git a/config/locales/extranet/en.yml b/config/locales/extranet/en.yml
index 2e24e05fc..e7aa2085e 100644
--- a/config/locales/extranet/en.yml
+++ b/config/locales/extranet/en.yml
@@ -2,8 +2,8 @@ en:
   extranet:
     account:
       my: My account
-      edit: Edit
-      edit_personal_data: Edit my personal data
+      edit: Edit account
+      edit_personal_data: Edit profile
       updated: Updated
       logout: Log out
     errors:
diff --git a/config/locales/extranet/fr.yml b/config/locales/extranet/fr.yml
index 8ea70d0ae..7f459d9c7 100644
--- a/config/locales/extranet/fr.yml
+++ b/config/locales/extranet/fr.yml
@@ -2,8 +2,8 @@ fr:
   extranet:
     account:
       my: Mon compte
-      edit: Modifier
-      edit_personal_data: Modifier mes données personnelles
+      edit: Modifier mon compte
+      edit_personal_data: Modifier mon profil
       updated: Mise à jour effectuée
       logout: Déconnexion
     errors:
-- 
GitLab