From a61f38f4854c8ac71f70bc7dfb49e934f2891c43 Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Wed, 16 Mar 2022 17:49:49 +0100
Subject: [PATCH] inflector

---
 app/controllers/admin/university/person/alumni_controller.rb | 2 +-
 app/models/university/person/alumnus/import.rb               | 4 ----
 app/views/admin/university/person/alumni/index.html.erb      | 2 +-
 config/admin_navigation.rb                                   | 2 +-
 config/initializers/inflections.rb                           | 1 +
 5 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/app/controllers/admin/university/person/alumni_controller.rb b/app/controllers/admin/university/person/alumni_controller.rb
index 5fd37feb5..93d4438b7 100644
--- a/app/controllers/admin/university/person/alumni_controller.rb
+++ b/app/controllers/admin/university/person/alumni_controller.rb
@@ -35,7 +35,7 @@ class Admin::University::Person::AlumniController < Admin::University::Applicati
   def breadcrumb
     super
     add_breadcrumb  University::Person::Alumnus.model_name.human(count: 2),
-                    admin_university_person_alumni_index_path
+                    admin_university_person_alumni_path
     breadcrumb_for  @alumnus
   end
 
diff --git a/app/models/university/person/alumnus/import.rb b/app/models/university/person/alumnus/import.rb
index 4a7a12f93..4dc7fb68a 100644
--- a/app/models/university/person/alumnus/import.rb
+++ b/app/models/university/person/alumnus/import.rb
@@ -7,10 +7,6 @@ class University::Person::Alumnus::Import < ApplicationRecord
 
   after_save :parse
 
-  def self.polymorphic_name
-    'University::Person::Alumnus::Import'
-  end
-
   def lines
     csv.count
   rescue
diff --git a/app/views/admin/university/person/alumni/index.html.erb b/app/views/admin/university/person/alumni/index.html.erb
index ce860626c..00d3f1961 100644
--- a/app/views/admin/university/person/alumni/index.html.erb
+++ b/app/views/admin/university/person/alumni/index.html.erb
@@ -5,7 +5,7 @@
 <%= paginate @alumni, theme: 'bootstrap-5' %>
 
 <% content_for :action_bar_left do %>
-  <%#= link_to t('import'),
+  <%= link_to t('import'),
               admin_university_person_alumnus_imports_path,
               class: button_classes if can? :manage, University::Person::Alumnus::Import %>
 <% end %>
diff --git a/config/admin_navigation.rb b/config/admin_navigation.rb
index acd7fbcfa..b2d084377 100644
--- a/config/admin_navigation.rb
+++ b/config/admin_navigation.rb
@@ -10,7 +10,7 @@ SimpleNavigation::Configuration.run do |navigation|
       primary.item :university, University.model_name.human, nil, { kind: :header }
       primary.item :university, University::Person.model_name.human(count: 2), admin_university_people_path, { icon: 'users-cog' }
       primary.item :university, University::Organization.model_name.human(count: 2), admin_university_organizations_path, { icon: 'building' }
-      primary.item :communication_alumni, University::Person::Alumnus.model_name.human(count: 2), admin_university_person_alumni_index_path, { icon: 'users' }
+      primary.item :communication_alumni, University::Person::Alumnus.model_name.human(count: 2), admin_university_person_alumni_path, { icon: 'users' }
     end
 
     if can?(:read, Education::Program)
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index 2f804f761..e01ebddbf 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -8,6 +8,7 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
   # inflect.singular /^(ox)en/i, '\1'
   # inflect.uncountable %w( fish sheep )
   inflect.irregular 'axis', 'axes'
+  inflect.irregular 'alumnus', 'alumni'
 end
 
 # These inflection rules are supported but not enabled by default:
-- 
GitLab