diff --git a/app/controllers/admin/communication/extranets_controller.rb b/app/controllers/admin/communication/extranets_controller.rb index 0cfc44d68431688b8ccd159d35f342cf2cdb369f..6cd178308d3b24fc6208e2454e2cabfce2a9ba4b 100644 --- a/app/controllers/admin/communication/extranets_controller.rb +++ b/app/controllers/admin/communication/extranets_controller.rb @@ -8,9 +8,11 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat end def show - @alumni = @extranet.about&.alumni - @cohorts = @extranet.about&.cohorts - @years = @extranet.about&.academic_years + @about = @extranet.about + @alumni = @about&.alumni + @cohorts = @about&.cohorts + @years = @about&.academic_years + @organizations = @about&.alumni_organizations breadcrumb end diff --git a/app/controllers/extranet/organizations_controller.rb b/app/controllers/extranet/organizations_controller.rb index d91329fb8279c04f91c6a3b8cbc040e21114cb7b..ee06ab51e823f369a0a2571ea27bb2839b246edb 100644 --- a/app/controllers/extranet/organizations_controller.rb +++ b/app/controllers/extranet/organizations_controller.rb @@ -4,7 +4,9 @@ class Extranet::OrganizationsController < Extranet::ApplicationController through_association: :organizations def index + @organizations = current_extranet.about&.alumni_organizations || @organizations @organizations = @organizations.ordered.page(params[:page]) + @count = @organizations.total_count breadcrumb end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 77e3ae32d26ff26481939a0dae5cdb59d3f3d4bb..f1829148334801bb7a90187e875f41c2eb9c1451 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -114,6 +114,16 @@ class Education::Program < ApplicationRecord has_many :alumni, through: :cohorts, source: :people + has_many :alumni_experiences, + -> { distinct }, + class_name: 'University::Person::Experience', + through: :alumni, + source: :experiences + has_many :alumni_organizations, + -> { distinct }, + class_name: 'University::Organization', + through: :alumni_experiences, + source: :organization has_many :academic_years, through: :cohorts diff --git a/app/models/education/school.rb b/app/models/education/school.rb index b5150fba513b7feeb0d2a5f36f469faa8f38cb7f..714451661a315ad2be2f6b37dfc7df7ee0f451d3 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -69,6 +69,16 @@ class Education::School < ApplicationRecord has_many :alumni, -> { distinct }, through: :programs + has_many :alumni_experiences, + -> { distinct }, + class_name: 'University::Person::Experience', + through: :alumni, + source: :experiences + has_many :alumni_organizations, + -> { distinct }, + class_name: 'University::Organization', + through: :alumni_experiences, + source: :organization has_many :academic_years, -> { distinct }, through: :programs diff --git a/app/views/admin/communication/extranets/show.html.erb b/app/views/admin/communication/extranets/show.html.erb index 23351aae9e712411b746a634e6a4ca210a92f79d..1a270a1963698411e4cee1326a69b7202cba0cf3 100644 --- a/app/views/admin/communication/extranets/show.html.erb +++ b/app/views/admin/communication/extranets/show.html.erb @@ -28,6 +28,12 @@ <%= Education::AcademicYear.model_name.human(count: @years.count).downcase %> </p> <% end %> +<% if @organizations %> + <p> + <%= @organizations.count %> + <%= University::Organization.model_name.human(count: @organizations.count).downcase %> + </p> +<% end %> <% content_for :action_bar_right do %> <%= edit_link @extranet %> diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index 4df287ce4de9a1685862a8367b2e03b4cc29e664..3ce8510ebcbc25717e780df003f37052023eb669 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -52,3 +52,22 @@ <% end %> </div> <% end %> + +<% if current_university.communication_extranets.any? && can?(:read, Communication::Extranet) %> + <h2 class="h4 my-4"><%= Communication::Extranet.model_name.human(count: 2) %></h2> + <div class="row"> + <% current_university.communication_extranets.each do |extranet| %> + <% next unless can?(:read, extranet) %> + <div class="col-md-4"> + <div class="card"> + <div class="card-body"> + <span class="float-end"><i class="fas fa-project-diagram fa-2x"></i></span> + <h4><%= extranet %></h4> + <p class="small"><%= extranet.url %></p> + <%= link_to t('show'), [:admin, extranet], class: button_classes('stretched-link') %> + </div> + </div> + </div> + <% end %> + </div> +<% end %> diff --git a/app/views/extranet/organizations/index.html.erb b/app/views/extranet/organizations/index.html.erb index 5796718de6abe4e3aee343cff839fdb3ac81f74a..b1229875b7627de2122e7d4ec855f4e31c3bd2b2 100644 --- a/app/views/extranet/organizations/index.html.erb +++ b/app/views/extranet/organizations/index.html.erb @@ -2,6 +2,10 @@ <header class="mb-5"> <h1><%= University::Organization.model_name.human(count: 2) %></h1> + <p> + <%= @count %> + <%= University::Organization.model_name.human(count: @count).downcase %> + </p> </header> <table class="<%= table_classes %>"> diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index d72d2e360f64007bf74fc5c3a436882e144b2f26..dcd43222b31c92c6049f9ab1ea77c12c41bc0948 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -88,8 +88,8 @@ en: one: Alumnus other: Alumni university/organization: - one: Third party - other: Third parties + one: Organization + other: Organizations university/organization/import: one: Import other: Imports diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 6bf97587cc43b5b0e9d659e6d594b27594f8ddd1..a401225ae0a8c5cf267e499a01385dd8b14804fe 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -88,8 +88,8 @@ fr: one: Alumnus other: Alumni university/organization: - one: Tierce partie - other: Tierces parties + one: Organisation + other: Organisations university/organization/import: one: Import other: Imports