diff --git a/app/models/education/academic_year.rb b/app/models/education/academic_year.rb index 47588caa3e3ad7fcdaf627bb3f8b669ec637de8e..50c9e240d00ac98b6734aea0da0cd61d465ce05c 100644 --- a/app/models/education/academic_year.rb +++ b/app/models/education/academic_year.rb @@ -19,10 +19,9 @@ class Education::AcademicYear < ApplicationRecord include WithUniversity - has_many :education_cohorts, - class_name: 'Education::Cohort' has_many :cohorts, class_name: 'Education::Cohort' + alias_attribute :education_cohorts, :cohorts # Dénormalisation des alumni pour le faceted search has_and_belongs_to_many :university_people, diff --git a/app/views/admin/education/academic_years/_list.html.erb b/app/views/admin/education/academic_years/_list.html.erb index fb8a61ce54151f747be38153e0e62bcfa06b65ae..ab318d9dad3df35d28bc69c287f86a53c1e8f55c 100644 --- a/app/views/admin/education/academic_years/_list.html.erb +++ b/app/views/admin/education/academic_years/_list.html.erb @@ -2,9 +2,8 @@ <thead> <tr> <th><%= Education::AcademicYear.human_attribute_name('year') %></th> - <th><%= Education::AcademicYear.human_attribute_name('cohorts') %></th> - <th><%= Education::AcademicYear.human_attribute_name('alumni') %></th> - <th></th> + <th><%= Education::Cohort.model_name.human(count: 2) %></th> + <th><%= University::Person::Alumnus.model_name.human(count: 2) %></th> </tr> </thead> <tbody> @@ -15,12 +14,6 @@ </td> <td><%= academic_year.cohorts.count %></td> <td><%= academic_year.people.count %></td> - <td class="text-end"> - <div class="btn-group" role="group"> - <%= edit_link academic_year %> - <%= destroy_link academic_year %> - </div> - </td> </tr> <% end %> </tbody> diff --git a/app/views/admin/education/academic_years/show.html.erb b/app/views/admin/education/academic_years/show.html.erb index a5cfbc21c4ccbc9346cbb264e1acfef9e9fe1c7e..a6410b0ffd811dcdabdf612b997c6d33b0d78da8 100644 --- a/app/views/admin/education/academic_years/show.html.erb +++ b/app/views/admin/education/academic_years/show.html.erb @@ -1 +1,11 @@ <% content_for :title, @academic_year %> + +<% if @academic_year.cohorts.any? %> + <h2><%= Education::Cohort.model_name.human(count: 2) %></h2> + <%= render 'admin/education/cohorts/list', cohorts: @academic_year.cohorts.ordered %> +<% end %> + +<% if @academic_year.people.any? %> + <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> + <%= render 'admin/university/alumni/list', alumni: @academic_year.people.ordered %> +<% end %> diff --git a/app/views/admin/education/cohorts/show.html.erb b/app/views/admin/education/cohorts/show.html.erb index db47cd66439b7f00969253b4a6748e02dd03496b..c043e0c1506f19df53ce96dde779d1bc24229171 100644 --- a/app/views/admin/education/cohorts/show.html.erb +++ b/app/views/admin/education/cohorts/show.html.erb @@ -1,10 +1,8 @@ <% content_for :title, @cohort %> - <div class="row"> <div class="col-md-8"> <div class="card flex-fill w-100"> - <div class="card-body"> <h3 class="h5"><%= Education::Cohort.human_attribute_name('program') %></h3> <p><%= link_to_if can?(:read, @cohort.program), @cohort.program, [:admin, @cohort.program] %></p> @@ -15,9 +13,6 @@ </div> </div> - - - <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> <%= render 'admin/university/alumni/list', alumni: @cohort.people.ordered %> diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 987d92601e68565c5265f47fa18c04ba71a478f4..e83ec1619925852f0974c3692cc7f9570885530e 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -20,6 +20,8 @@ en: one: School other: Schools attributes: + education/academic_year: + year: Year education/cohort: alumni: Alumni program: Program diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index 6211e767b844055cab8fc785720bd0ac1d1b793f..1c657a83016d3269dec0c90c9042cfff7aa43c70 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -20,6 +20,8 @@ fr: one: École other: Écoles attributes: + education/academic_year: + year: Année education/cohort: alumni: Alumni program: Formation