From 9f1e83ed4919ee2486f35b66315d4160add4a662 Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Mon, 16 May 2022 18:25:56 +0200 Subject: [PATCH] wip alumni --- app/models/education/academic_year.rb | 3 +-- .../admin/education/academic_years/_list.html.erb | 11 ++--------- .../admin/education/academic_years/show.html.erb | 10 ++++++++++ app/views/admin/education/cohorts/show.html.erb | 5 ----- config/locales/education/en.yml | 2 ++ config/locales/education/fr.yml | 2 ++ 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/app/models/education/academic_year.rb b/app/models/education/academic_year.rb index 47588caa3..50c9e240d 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 fb8a61ce5..ab318d9da 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 a5cfbc21c..a6410b0ff 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 db47cd664..c043e0c15 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 987d92601..e83ec1619 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 6211e767b..1c657a830 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 -- GitLab