From 82781f0f0ff9f9094c5dfc4ed61ff08a24c2973f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Fri, 10 Mar 2023 10:26:06 +0100 Subject: [PATCH] current exp --- .../extranet/pages/_experiences.sass | 7 ++- .../extranet/contacts/persons_controller.rb | 1 + .../contacts/organizations/show.html.erb | 57 ++++++++++--------- .../extranet/contacts/persons/show.html.erb | 30 +++++++++- config/locales/extranet/en.yml | 4 ++ config/locales/extranet/fr.yml | 4 ++ 6 files changed, 72 insertions(+), 31 deletions(-) diff --git a/app/assets/stylesheets/extranet/pages/_experiences.sass b/app/assets/stylesheets/extranet/pages/_experiences.sass index 39dbc8668..efbd0e9f1 100644 --- a/app/assets/stylesheets/extranet/pages/_experiences.sass +++ b/app/assets/stylesheets/extranet/pages/_experiences.sass @@ -1,2 +1,5 @@ -.experience__organization__logo - height: 100% \ No newline at end of file +.experience + line-height: px2rem(24) + position: relative + &__organization__logo + height: 100% \ No newline at end of file diff --git a/app/controllers/extranet/contacts/persons_controller.rb b/app/controllers/extranet/contacts/persons_controller.rb index 6ef8e86c3..5d6b40885 100644 --- a/app/controllers/extranet/contacts/persons_controller.rb +++ b/app/controllers/extranet/contacts/persons_controller.rb @@ -10,6 +10,7 @@ class Extranet::Contacts::PersonsController < Extranet::Contacts::ApplicationCon def show @person = current_extranet.connected_persons.find(params[:id]) + @current_experiences = @person.experiences.includes(:organization).current.ordered breadcrumb end diff --git a/app/views/extranet/contacts/organizations/show.html.erb b/app/views/extranet/contacts/organizations/show.html.erb index e2f612bf2..855d43325 100644 --- a/app/views/extranet/contacts/organizations/show.html.erb +++ b/app/views/extranet/contacts/organizations/show.html.erb @@ -7,35 +7,36 @@ <div class="biography mb-5"> <%= sanitize @organization.text %> </div> - <div class="experiences mb-5"> - <h3>Membres de cette organisation (<%= @current_experiences.pluck(:person_id).uniq.size %>)</h3> + <% if @current_experiences.any? %> + <div class="experiences mb-5"> + <h3><%= t('extranet.contacts.organizations.experiences', count: @current_experiences.pluck(:person_id).uniq.size) %></h3> - <% @current_experiences.each do |experience| %> - <article class="person mb-4"> - <div class="row gx-3"> - <div class="col-md-3"> - <% if experience.person.best_picture.attached? %> - <%= kamifusen_tag experience.person.best_picture, width: 400, class: 'img-fluid', - sizes: { - '(max-width: 576px)': '400px', - '(max-width: 991px)': '200px' - } %> - <% else %> - <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> - <% end %> - </div> - <div class="col-md-9"> - <%= link_to [:contacts, experience.person], class: 'stretched-link' do %> - <p> - <b><%= experience.person.first_name %> <%= experience.person.last_name %></b><br> - <span class="text-muted"><%= experience.description %></span> - </p> - <% end %> - </div> - </article> - - <% end %> - </div> + <% @current_experiences.each do |experience| %> + <article class="experience mb-4"> + <div class="row gx-3"> + <div class="col-md-3"> + <% if experience.person.best_picture.attached? %> + <%= kamifusen_tag experience.person.best_picture, width: 400, class: 'img-fluid', + sizes: { + '(max-width: 576px)': '400px', + '(max-width: 991px)': '200px' + } %> + <% else %> + <%= image_tag 'extranet/avatar.png', width: 400, class: 'img-fluid' %> + <% end %> + </div> + <div class="col-md-9"> + <%= link_to [:contacts, experience.person], class: 'stretched-link' do %> + <p> + <b><%= experience.person.first_name %> <%= experience.person.last_name %></b><br> + <span class="text-muted"><%= experience.description %></span> + </p> + <% end %> + </div> + </article> + <% end %> + </div> + <% end %> </div> </div> </div> diff --git a/app/views/extranet/contacts/persons/show.html.erb b/app/views/extranet/contacts/persons/show.html.erb index 36302396a..5e5d54c01 100644 --- a/app/views/extranet/contacts/persons/show.html.erb +++ b/app/views/extranet/contacts/persons/show.html.erb @@ -10,10 +10,38 @@ </p> <% end %> <% unless @person.biography.blank? %> - <div class="biography mt-5"> + <div class="biography my-5"> <%= sanitize @person&.biography %> </div> <% end %> + <% if @current_experiences.any? %> + <div class="experiences mb-5"> + <h3><%= t('extranet.contacts.persons.experiences', count: @current_experiences.pluck(:organization_id).uniq.size) %></h3> + + <% @current_experiences.each do |experience| %> + <article class="experience mb-4"> + <div class="row gx-3"> + <div class="col-md-3"> + <% if experience.organization.logo.attached? %> + <%= kamifusen_tag experience.organization.logo, width: 400, class: 'img-fluid', + sizes: { + '(max-width: 576px)': '400px', + '(max-width: 991px)': '200px' + } %> + <% end %> + </div> + <div class="col-md-9"> + <%= link_to [:contacts, experience.organization], class: 'stretched-link' do %> + <p> + <b><%= experience.organization %></b><br> + <span class="text-muted"><%= experience.description %></span> + </p> + <% end %> + </div> + </article> + <% end %> + </div> + <% end %> </div> </div> </div> diff --git a/config/locales/extranet/en.yml b/config/locales/extranet/en.yml index fb877a0b8..b789aa4c1 100644 --- a/config/locales/extranet/en.yml +++ b/config/locales/extranet/en.yml @@ -8,6 +8,10 @@ en: updated: Updated logout: Log out contacts: + organizations: + experiences: Members of this organization (%{count}) + persons: + experiences: Organizations where they belong (%{count}) search: home: Search in directory title: Search diff --git a/config/locales/extranet/fr.yml b/config/locales/extranet/fr.yml index 87fcc92b5..7b424a6d9 100644 --- a/config/locales/extranet/fr.yml +++ b/config/locales/extranet/fr.yml @@ -8,6 +8,10 @@ fr: updated: Mise à jour effectuée logout: Déconnexion contacts: + organizations: + experiences: Membres de cette organisation (%{count}) + persons: + experiences: Organisations dont iel fait partie (%{count}) search: home: Chercher dans l'annuaire title: Recherche -- GitLab