Skip to content
Snippets Groups Projects
Unverified Commit dc128db7 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

current experiences in orga

parent fe84bdb0
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ class Extranet::Contacts::OrganizationsController < Extranet::Contacts::Applicat
def show
@organization = current_extranet.connected_organizations.find(params[:id])
@current_experiences = @organization.experiences.includes(:person).current.ordered
breadcrumb
end
......
......@@ -41,6 +41,7 @@ class University::Person::Experience < ApplicationRecord
before_validation :create_organization_if_needed
scope :current, -> { where('from_year <= :current_year AND (to_year IS NULL OR to_year >= :current_year)', current_year: Date.today.year) }
scope :ordered, -> { order('university_person_experiences.to_year DESC NULLS FIRST, university_person_experiences.from_year') }
scope :recent, -> {
where.not(from_year: nil)
......
......@@ -7,6 +7,35 @@
<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>
<% @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>
</div>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment