diff --git a/app/assets/javascripts/admin/university/edit.js b/app/assets/javascripts/admin/university/edit.js index 9799b2a344ed7d58e4e802377eb1091bc79ba1fe..f28aff7782236f888f513731d91113adc074696e 100644 --- a/app/assets/javascripts/admin/university/edit.js +++ b/app/assets/javascripts/admin/university/edit.js @@ -3,17 +3,20 @@ window.osuny.university.edit = { 'use strict'; this.hasSsoInput = document.querySelector('input[type="checkbox"][name="university[has_sso]"]'); this.hasSsoInput.addEventListener('change', this.onHasSsoChange.bind(this)); - this.ssoFields = document.getElementById('sso-inputs'); + this.ssoFields = document.querySelectorAll('.sso-inputs'); this.onHasSsoChange(); }, onHasSsoChange: function () { 'use strict'; - var value = this.hasSsoInput.checked; - if (value) { - this.ssoFields.classList.remove('d-none'); - } else { - this.ssoFields.classList.add('d-none'); + var value = this.hasSsoInput.checked, + i; + for (i = 0; i < this.ssoFields.length; i += 1) { + if (value) { + this.ssoFields[i].classList.remove('d-none'); + } else { + this.ssoFields[i].classList.add('d-none'); + } } }, diff --git a/app/controllers/extranet/academic_years_controller.rb b/app/controllers/extranet/academic_years_controller.rb index 822020505aefc4632416f284104aaa56e217ff34..8fe001a2b8684c27851afe89d915e84562c7a42d 100644 --- a/app/controllers/extranet/academic_years_controller.rb +++ b/app/controllers/extranet/academic_years_controller.rb @@ -1,10 +1,10 @@ class Extranet::AcademicYearsController < Extranet::ApplicationController load_and_authorize_resource class: Education::AcademicYear, - through: :current_university, - through_association: :academic_years + through: :about, + through_association: :education_academic_years def index - @academic_years = about&.academic_years + @academic_years = about&.education_academic_years .ordered .page(params[:page]) .per(20) diff --git a/app/controllers/extranet/cohorts_controller.rb b/app/controllers/extranet/cohorts_controller.rb index 62ee6a5603936fffa448914a12e76101c50a75b5..b249e48a3a5073f7da8537cedfa599240000ee24 100644 --- a/app/controllers/extranet/cohorts_controller.rb +++ b/app/controllers/extranet/cohorts_controller.rb @@ -1,11 +1,11 @@ class Extranet::CohortsController < Extranet::ApplicationController load_and_authorize_resource class: Education::Cohort, - through: :current_university, + through: :about, through_association: :education_cohorts def index @facets = Education::Cohort::Facets.new params[:facets], { - model: about.cohorts, + model: about.education_cohorts, about: about } @cohorts = @facets.results diff --git a/app/controllers/extranet/home_controller.rb b/app/controllers/extranet/home_controller.rb index 41f0e8a1988fa589601f394d52f3ec9c05179938..2fd1bc392397c974ead90cb20610ac81fabaa5df 100644 --- a/app/controllers/extranet/home_controller.rb +++ b/app/controllers/extranet/home_controller.rb @@ -1,7 +1,7 @@ class Extranet::HomeController < Extranet::ApplicationController def index return redirect_to admin_root_path unless current_extranet - @cohorts = about&.cohorts.ordered.limit(5) - @experiences = about&.experiences.ordered.limit(10) + @cohorts = about&.education_cohorts.ordered.limit(5) + @experiences = about&.university_person_experiences.ordered.limit(10) end end diff --git a/app/controllers/extranet/organizations_controller.rb b/app/controllers/extranet/organizations_controller.rb index 1f8e867b1cda98c5fbc04ed8fa091f10f7da284c..ec718d441227937335a651247c3c12cdb6530ea3 100644 --- a/app/controllers/extranet/organizations_controller.rb +++ b/app/controllers/extranet/organizations_controller.rb @@ -1,11 +1,11 @@ class Extranet::OrganizationsController < Extranet::ApplicationController load_and_authorize_resource class: University::Organization, - through: :current_university, - through_association: :organizations + through: :about, + through_association: :university_person_alumni_organizations def index @facets = University::Organization::Facets.new params[:facets], { - model: about&.alumni_organizations, + model: about&.university_person_alumni_organizations, about: about } @organizations = @facets.results diff --git a/app/controllers/extranet/persons_controller.rb b/app/controllers/extranet/persons_controller.rb index 866a2e30cdf38d4a1f0a0bca1c9e1ccd371f8fd3..b94f7ad997e2b7a976ee182f733482614aa2e3ed 100644 --- a/app/controllers/extranet/persons_controller.rb +++ b/app/controllers/extranet/persons_controller.rb @@ -1,12 +1,12 @@ class Extranet::PersonsController < Extranet::ApplicationController load_and_authorize_resource class: University::Person::Alumnus, - through: :current_university, - through_association: :people + through: :about, + through_association: :university_person_alumni def index @facets = University::Person::Alumnus::Facets.new params[:facets], { - model: about&.alumni, - about: current_extranet.about + model: about&.university_person_alumni, + about: about } @people = @facets.results .ordered diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 1a9704e336c663c6d356be844382b5e07b25b587..2ed2c2351302d09aed180b0e48c1b7fe5bd89a4c 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -114,32 +114,33 @@ class Education::Program < ApplicationRecord -> { distinct }, through: :schools - has_many :cohorts, - class_name: 'Education::Cohort' has_many :education_cohorts, class_name: 'Education::Cohort' + alias_attribute :cohorts, :education_cohorts has_many :alumni, - through: :cohorts, + through: :education_cohorts, source: :people + alias_attribute :university_person_alumni, :alumni has_many :alumni_experiences, -> { distinct }, class_name: 'University::Person::Experience', through: :alumni, source: :experiences - alias_attribute :experiences, :alumni_experiences + alias_attribute :university_person_experiences, :alumni_experiences has_many :alumni_organizations, -> { distinct }, class_name: 'University::Organization', through: :alumni_experiences, source: :organization + alias_attribute :university_person_alumni_organizations, :alumni_organizations has_many :education_academic_years, -> { distinct }, class_name: 'Education::AcademicYear', - through: :cohorts, + through: :education_cohorts, source: :academic_year alias_attribute :academic_years, :education_academic_years diff --git a/app/models/education/school.rb b/app/models/education/school.rb index 8bf4ed5acf52044b14baa50cf68d20bb29d72948..c7399a66dca85204b7c5e11b904e37a070144457 100644 --- a/app/models/education/school.rb +++ b/app/models/education/school.rb @@ -70,27 +70,29 @@ class Education::School < ApplicationRecord has_many :alumni, -> { distinct }, through: :programs + alias_attribute :university_person_alumni, :alumni + has_many :alumni_experiences, -> { distinct }, class_name: 'University::Person::Experience', through: :alumni, source: :experiences - alias_attribute :experiences, :alumni_experiences + alias_attribute :university_person_experiences, :alumni_experiences has_many :alumni_organizations, -> { distinct }, class_name: 'University::Organization', through: :alumni_experiences, source: :organization + alias_attribute :university_person_alumni_organizations, :alumni_organizations has_many :education_academic_years, -> { distinct }, class_name: 'Education::AcademicYear', through: :programs - alias_attribute :academic_years, :education_academic_years + alias_attribute :academic_years, :education_academic_years has_many :education_cohorts, -> { distinct }, class_name: 'Education::Cohort', - through: :programs, - source: :cohorts - alias_attribute :cohorts, :education_cohorts + through: :programs + alias_attribute :cohorts, :education_cohorts validates :name, :address, :city, :zipcode, :country, presence: true diff --git a/app/models/university/person/alumnus/import.rb b/app/models/university/person/alumnus/import.rb index d20bb55ea706dbba6ecad79822f23ac4bf44c31c..43e09d84c535aea87095ba0e7a799619369d8d39 100644 --- a/app/models/university/person/alumnus/import.rb +++ b/app/models/university/person/alumnus/import.rb @@ -157,6 +157,12 @@ class University::Person::Alumnus::Import < ApplicationRecord # 'f4d4a92f-8b8f-4778-a127-9293684666be' => 'fab9b86c-8872-4df5-9a97-0e30b104a837', # DU_BILINGUE # '6df53074-195c-4299-8b49-bbc9d7cad41a' => 'cb1a26b9-fe5c-4ad1-9715-71cec4642910', # DU_JRI # '0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '91c44fd2-f0a4-4189-a3f5-311322b7b472' # DUT_JOURNALISME + # Sebou + # 'c6b78fac-0a5f-4c44-ad22-4ee68ed382bb' => 'ea5d32be-b86a-4257-984a-4d84717dd1d6', # DUT MMI + # 'ae3e067a-63b4-4c3f-ba9c-468ade0e4182' => '701c3a4f-3585-4152-b866-da17f4e80e77', # MASTER IJBA + # 'f4d4a92f-8b8f-4778-a127-9293684666be' => '0c05b690-ebd1-4efa-862c-81ea0978fb0b', # DU_BILINGUE + # '6df53074-195c-4299-8b49-bbc9d7cad41a' => '4ded6dfa-2fab-4e77-b58d-0d97344a04d1', # DU_JRI + # '0d81d3a2-a12c-4326-a395-fd0df4a3ea4f' => '4edac5cd-6564-4e47-a18c-960d3e5de54e' # DUT_JOURNALISME } id = substitutes[id] if substitutes.has_key? id end diff --git a/app/views/admin/application/_nav.html.erb b/app/views/admin/application/_nav.html.erb index 8843006cbca3dea2d01a640db1fa75913e5ff3d5..ae1ae913b18fbc8acb4c095ebf7d5ba134ac5f1b 100644 --- a/app/views/admin/application/_nav.html.erb +++ b/app/views/admin/application/_nav.html.erb @@ -5,7 +5,14 @@ <% end %> <%= render_navigation context: :admin %> + <footer class="small my-5"> + <hr> + <div class="sidebar-header"> + <p class="small"> + <%= t('admin.number_of_enqueued_tasks', tasks: Delayed::Job.all.length) %> + </p> + </div> <hr> <%= link_to 'API', api_root_path, class: 'sidebar-link' %> <% diff --git a/app/views/server/universities/_form.html.erb b/app/views/server/universities/_form.html.erb index 3defd9c1efda9aeb3b8c2a43542566547fb9317e..a08d955d57cb8dd5b58ae9d2db276c7ecfce8559 100644 --- a/app/views/server/universities/_form.html.erb +++ b/app/views/server/universities/_form.html.erb @@ -35,13 +35,13 @@ <div class="row"> <div class="col-md-6"> <%= f.input :has_sso %> - <div id="sso-inputs"> + <div class="sso-inputs"> <%= f.input :sso_target_url, required: true %> <%= f.input :sso_cert, required: true %> <%= f.input :sso_name_identifier_format, required: true %> </div> </div> - <div class="col-md-6"> + <div class="col-md-6 sso-inputs"> <h4 class="mb-4"><%= University.human_attribute_name('sso_mapping') %></h4> <%= f.error_notification message: f.object.errors[:sso_mapping].to_sentence if f.object.errors[:sso_mapping].present? %> <%= render 'sso_mapping', university: university %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 413c3e8cf60e353600c964f9647c803282cc5671..013fe4bf78609dc146ad49d5be36e18ddb01edb5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -47,6 +47,7 @@ en: sentence_without_link: Value inherited sentence_html: Value inherited from %{link} status: Inherited value + number_of_enqueued_tasks: "Number of enqueued tasks: %{tasks}" password_hint: Leave blank if you do not wish to change the password. successfully_created_html: "<i>%{model}</i> was successfully created." successfully_destroyed_html: "<i>%{model}</i> was successfully destroyed." diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 1e8778ab47e657036fd405f8e669a9cf92f14fe9..ad8733416ad22d7556982fa880d8af79d0c5b4a4 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -47,6 +47,7 @@ fr: sentence_without_link: Valeur héritée sentence_html: Valeur héritée de %{link} status: Valeur héritée + number_of_enqueued_tasks: "Nombre de tâches à traiter : %{tasks}" password_hint: Laissez vide si vous ne souhaitez pas modifier le mot de passe. successfully_created_html: "<i>%{model}</i> a bien été créé(e)." successfully_destroyed_html: "<i>%{model}</i> a bien été détruit(e)." diff --git a/config/routes/extranet.rb b/config/routes/extranet.rb index 2afd7680ebcedda96ad114d75de3886ba2a5a66f..dfb9725e828f9a4dad77e525e094e19232c2a6bd 100644 --- a/config/routes/extranet.rb +++ b/config/routes/extranet.rb @@ -1,7 +1,7 @@ get 'cohorts' => 'extranet/cohorts#index', as: :education_cohorts get 'cohorts/:id' => 'extranet/cohorts#show', as: :education_cohort get 'organizations' => 'extranet/organizations#index', as: :university_organizations -get 'organization/:id' => 'extranet/organizations#show', as: :university_organization +get 'organizations/:id' => 'extranet/organizations#show', as: :university_organization get 'persons' => 'extranet/persons#index', as: :university_persons get 'persons/:id' => 'extranet/persons#show', as: :university_person get 'years' => 'extranet/academic_years#index', as: :education_academic_years diff --git a/db/schema.rb b/db/schema.rb index 4c5f75e298ca6a282c02fd174577cd38ba7d4d40..7b136e975811cbc6607a421b13c6ffdd891011f2 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -490,23 +490,6 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.index ["university_id"], name: "index_education_schools_on_university_id" end - create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| - t.string "title" - t.text "description" - t.string "address" - t.string "zipcode" - t.string "city" - t.string "country" - t.string "website" - t.string "phone" - t.string "mail" - t.boolean "active" - t.string "sirene" - t.integer "kind" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - end - create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" @@ -697,8 +680,8 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.string "linkedin" t.boolean "is_alumnus", default: false t.text "description_short" - t.string "name" t.boolean "is_author" + t.string "name" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end