Skip to content
Snippets Groups Projects
Commit 1cab982b authored by Arnaud Levy's avatar Arnaud Levy
Browse files

ijba

parent ce8427ea
No related branches found
No related tags found
No related merge requests found
......@@ -21,3 +21,6 @@ main.content
.card-footer
.pagination
margin-bottom: 0
.alert
padding: .95rem
.alert
padding: .95rem
&-danger
......
......@@ -4,7 +4,7 @@ class Extranet::PersonsController < Extranet::ApplicationController
through_association: :people
def index
@people = @people.alumni
@people = current_context.about&.alumni || @people.alumni
breadcrumb
end
......
......@@ -111,6 +111,9 @@ class Education::Program < ApplicationRecord
class_name: 'Education::Cohort'
has_many :websites, -> { distinct },
through: :schools
has_many :alumni,
through: :cohorts,
source: :people
accepts_nested_attributes_for :university_person_involvements, reject_if: :all_blank, allow_destroy: true
......
......@@ -66,6 +66,9 @@ class Education::School < ApplicationRecord
through: :published_programs,
source: :university_people_through_role_involvements
has_many :alumni,
through: :programs
validates :name, :address, :city, :zipcode, :country, presence: true
scope :ordered, -> { order(:name) }
......
......@@ -34,7 +34,11 @@ class University::Person::Alumnus::Import < ApplicationRecord
if Rails.env.development?
# substitute local data for testing
substitutes = {
'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => '23279cab-8bc1-4c75-bcd8-1fccaa03ad55'
'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => '23279cab-8bc1-4c75-bcd8-1fccaa03ad55', # DUT MMI
'ae3e067a-63b4-4c3f-ba9c-468ade0e4182' => '863b8c9c-1ed1-4af7-b92c-7264dfb6b4da', # MASTER IJBA
'f4d4a92f-8b8f-4778-a127-9293684666be' => '8dfaee2a-c876-4b1c-8e4e-8380d720c71f', # DU_BILINGUE
'6df53074-195c-4299-8b49-bbc9d7cad41a' => 'be3cb0b2-7f66-4c5f-b8d7-6a39a0480c46', # DU_JRI
'0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '56a50383-3ef7-43f6-8e98-daf279e86802' # DUT_JOURNALISME
}
program_id = substitutes[program_id] if substitutes.has_key? program_id
end
......@@ -59,11 +63,12 @@ class University::Person::Alumnus::Import < ApplicationRecord
.first_or_create
person.first_name = first_name
person.last_name = last_name
else
elsif first_name.present? && last_name.present?
person = university.people
.where(first_name: first_name, last_name: last_name)
.first_or_create
end
next unless person
# TODO all fields
# gender
# birth
......
<% if @program.cohorts.any? %>
<div class="card flex-fill w-100">
<div class="card-header">
<div class="float-end">
<%= @program.alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: 2).downcase %>
</div>
<h5 class="card-title mb-0"><%= Education::Cohort.model_name.human(count: 2) %></h5>
</div>
<table class="<%= table_classes %>">
......
......@@ -32,6 +32,8 @@
<li><%= link_to_if can?(:read, program), program, [:admin, program] %></li>
<% end %>
</ul>
<%= @school.alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: 2).downcase %>
</div>
</div>
</div>
......
......@@ -35,15 +35,15 @@
<dt><%= cohort.program %></dt>
<dd><%= link_to cohort.academic_year, cohort %></dd>
<% end %>
<% if @person.phone %>
<% if @person.phone.present? %>
<dt><%= University::Person.human_attribute_name(:phone) %></dt>
<dd><a href="tel:<%= @person.phone %>" target="_blank" rel="noreferrer"><%= @person.phone %></a></dd>
<% end %>
<% if @person.email %>
<% if @person.email.present? %>
<dt><%= University::Person.human_attribute_name(:email) %></dt>
<dd><a href="mailto:<%= @person.email %>" target="_blank" rel="noreferrer"><%= @person.email %></a></dd>
<% end %>
<% if @person.url %>
<% if @person.url.present? %>
<dt><%= University::Person.human_attribute_name(:url) %></dt>
<dd>
<a href="<%= social_website_to_url @person.url %>" target="_blank" rel="noreferrer">
......@@ -51,7 +51,7 @@
</a>
</dd>
<% end %>
<% if @person.linkedin %>
<% if @person.linkedin.present? %>
<dt><%= University::Person.human_attribute_name(:linkedin) %></dt>
<dd>
<a href="<%= social_linkedin_to_url @person.linkedin %>" target="_blank" rel="noreferrer">
......@@ -59,7 +59,7 @@
</a>
</dd>
<% end %>
<% if @person.twitter %>
<% if @person.twitter.present? %>
<dt><%= University::Person.human_attribute_name(:twitter) %></dt>
<dd>
<a href="<%= social_twitter_to_url @person.twitter %>" target="_blank" rel="noreferrer">
......
......@@ -17,6 +17,9 @@ en:
one: School
other: Schools
attributes:
education/cohort:
year: Year
alumni: Alumni
education/program:
accessibility: Accessibilité
capacity: Capacity
......
......@@ -17,6 +17,9 @@ fr:
one: École
other: Écoles
attributes:
education/cohort:
year: Année
alumni: Alumni
education/program:
accessibility: Accessibilité
capacity: Capacité
......
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