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

extranet show

parent 1cab982b
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,9 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat
end
def show
@alumni = @extranet.about&.alumni
@cohorts = @extranet.about&.cohorts
@years = @extranet.about&.academic_years
breadcrumb
end
......
......@@ -114,6 +114,8 @@ class Education::Program < ApplicationRecord
has_many :alumni,
through: :cohorts,
source: :people
has_many :academic_years,
through: :cohorts
accepts_nested_attributes_for :university_person_involvements, reject_if: :all_blank, allow_destroy: true
......
......@@ -67,6 +67,13 @@ class Education::School < ApplicationRecord
source: :university_people_through_role_involvements
has_many :alumni,
-> { distinct },
through: :programs
has_many :academic_years,
-> { distinct },
through: :programs
has_many :cohorts,
-> { distinct },
through: :programs
validates :name, :address, :city, :zipcode, :country, presence: true
......
......@@ -10,6 +10,25 @@
<% end %>
<% end %>
<% if @alumni %>
<p>
<%= @alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: @alumni.count).downcase %>
</p>
<% end %>
<% if @cohorts %>
<p>
<%= @cohorts.count %>
<%= Education::Cohort.model_name.human(count: @cohorts.count).downcase %>
</p>
<% end %>
<% if @years %>
<p>
<%= @years.count %>
<%= Education::AcademicYear.model_name.human(count: @years.count).downcase %>
</p>
<% end %>
<% content_for :action_bar_right do %>
<%= edit_link @extranet %>
<%= destroy_link @extranet %>
......
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