diff --git a/Gemfile.lock b/Gemfile.lock index 92c4809d69efee91c96d0dd265033cdeab118141..ecf1a59046b794985462f9216b6cdd2ad3900aaa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -20,60 +20,60 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.5.1) - actionpack (= 6.1.5.1) - activesupport (= 6.1.5.1) + actioncable (6.1.6) + actionpack (= 6.1.6) + activesupport (= 6.1.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.5.1) - actionpack (= 6.1.5.1) - activejob (= 6.1.5.1) - activerecord (= 6.1.5.1) - activestorage (= 6.1.5.1) - activesupport (= 6.1.5.1) + actionmailbox (6.1.6) + actionpack (= 6.1.6) + activejob (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) mail (>= 2.7.1) - actionmailer (6.1.5.1) - actionpack (= 6.1.5.1) - actionview (= 6.1.5.1) - activejob (= 6.1.5.1) - activesupport (= 6.1.5.1) + actionmailer (6.1.6) + actionpack (= 6.1.6) + actionview (= 6.1.6) + activejob (= 6.1.6) + activesupport (= 6.1.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.5.1) - actionview (= 6.1.5.1) - activesupport (= 6.1.5.1) + actionpack (6.1.6) + actionview (= 6.1.6) + activesupport (= 6.1.6) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.5.1) - actionpack (= 6.1.5.1) - activerecord (= 6.1.5.1) - activestorage (= 6.1.5.1) - activesupport (= 6.1.5.1) + actiontext (6.1.6) + actionpack (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) nokogiri (>= 1.8.5) - actionview (6.1.5.1) - activesupport (= 6.1.5.1) + actionview (6.1.6) + activesupport (= 6.1.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.5.1) - activesupport (= 6.1.5.1) + activejob (6.1.6) + activesupport (= 6.1.6) globalid (>= 0.3.6) - activemodel (6.1.5.1) - activesupport (= 6.1.5.1) - activerecord (6.1.5.1) - activemodel (= 6.1.5.1) - activesupport (= 6.1.5.1) - activestorage (6.1.5.1) - actionpack (= 6.1.5.1) - activejob (= 6.1.5.1) - activerecord (= 6.1.5.1) - activesupport (= 6.1.5.1) + activemodel (6.1.6) + activesupport (= 6.1.6) + activerecord (6.1.6) + activemodel (= 6.1.6) + activesupport (= 6.1.6) + activestorage (6.1.6) + actionpack (= 6.1.6) + activejob (= 6.1.6) + activerecord (= 6.1.6) + activesupport (= 6.1.6) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.5.1) + activesupport (6.1.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -88,7 +88,7 @@ GEM autoprefixer-rails (10.4.7.0) execjs (~> 2) aws-eventstream (1.2.0) - aws-partitions (1.585.0) + aws-partitions (1.587.0) aws-sdk-core (3.130.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) @@ -121,7 +121,7 @@ GEM builder (3.2.4) byebug (11.1.3) cancancan (3.3.0) - capybara (3.36.0) + capybara (3.37.1) addressable matrix mini_mime (>= 0.1.3) @@ -142,7 +142,8 @@ GEM crack (0.4.5) rexml crass (1.0.6) - curation (1.8) + curation (1.9) + htmlentities metainspector nokogiri delayed_job (4.1.10) @@ -229,6 +230,7 @@ GEM hash_dot (2.5.0) hashdiff (1.0.1) hashie (5.0.0) + htmlentities (4.3.4) http-cookie (1.0.4) domain_name (~> 0.5) httparty (0.20.0) @@ -251,7 +253,7 @@ GEM thor (>= 0.14, < 2.0) js_cookie_rails (2.2.0) railties (>= 3.1) - json (2.6.1) + json (2.6.2) jwt (2.3.0) kamifusen (1.11.2) image_processing @@ -271,14 +273,14 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.17.0) + loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) marcel (1.0.2) matrix (0.4.2) - metainspector (5.12.0) + metainspector (5.12.1) addressable (~> 2.7) faraday (>= 1.4, < 3.0) faraday-cookie_jar (~> 0.0) @@ -304,7 +306,7 @@ GEM ruby2_keywords (~> 0.0.1) nesty (1.0.2) nio4r (2.5.8) - nokogiri (1.13.5) + nokogiri (1.13.6) mini_portile2 (~> 2.8.0) racc (~> 1.4) oauth2 (1.4.9) @@ -340,20 +342,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.5.1) - actioncable (= 6.1.5.1) - actionmailbox (= 6.1.5.1) - actionmailer (= 6.1.5.1) - actionpack (= 6.1.5.1) - actiontext (= 6.1.5.1) - actionview (= 6.1.5.1) - activejob (= 6.1.5.1) - activemodel (= 6.1.5.1) - activerecord (= 6.1.5.1) - activestorage (= 6.1.5.1) - activesupport (= 6.1.5.1) + rails (6.1.6) + actioncable (= 6.1.6) + actionmailbox (= 6.1.6) + actionmailer (= 6.1.6) + actionpack (= 6.1.6) + actiontext (= 6.1.6) + actionview (= 6.1.6) + activejob (= 6.1.6) + activemodel (= 6.1.6) + activerecord (= 6.1.6) + activestorage (= 6.1.6) + activesupport (= 6.1.6) bundler (>= 1.15.0) - railties (= 6.1.5.1) + railties (= 6.1.6) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -363,9 +365,9 @@ GEM rails-i18n (7.0.3) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (6.1.5.1) - actionpack (= 6.1.5.1) - activesupport (= 6.1.5.1) + railties (6.1.6) + actionpack (= 6.1.6) + activesupport (= 6.1.6) method_source rake (>= 12.2) thor (~> 1.0) @@ -374,7 +376,7 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.3.1) + regexp_parser (2.4.0) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) diff --git a/app/controllers/admin/communication/unsplash_controller.rb b/app/controllers/admin/communication/unsplash_controller.rb index f3ecdc1479e1f2199f3108480e867f856889bf9d..964023c35472cc05eea1139e46bc0552738addd9 100644 --- a/app/controllers/admin/communication/unsplash_controller.rb +++ b/app/controllers/admin/communication/unsplash_controller.rb @@ -11,9 +11,9 @@ class Admin::Communication::UnsplashController < Admin::Communication::Applicati query: params[:query], page: (params[:page].presence || 1), per_page: (params[:per_page].presence || 10), - orientation: (params[:orientation].presence || 'squarish'), lang: (params[:lang].presence || 'en') } + p[:orientation] = params[:orientation] if params.has_key? :orientation @search = Unsplash::Search.search "/search/photos", Unsplash::Photo, p @total = @search.total @total_pages = @search.total_pages diff --git a/app/controllers/admin/university/people/alumni/imports_controller.rb b/app/controllers/admin/university/alumni/imports_controller.rb similarity index 79% rename from app/controllers/admin/university/people/alumni/imports_controller.rb rename to app/controllers/admin/university/alumni/imports_controller.rb index 66b44d7499842bcae400aa6f4585e915e3d05d46..6de670ed80e5bf1553e35da571b3d1bea1f5a2e1 100644 --- a/app/controllers/admin/university/people/alumni/imports_controller.rb +++ b/app/controllers/admin/university/alumni/imports_controller.rb @@ -1,4 +1,4 @@ -class Admin::University::People::Alumni::ImportsController < Admin::University::ApplicationController +class Admin::University::Alumni::ImportsController < Admin::University::ApplicationController load_and_authorize_resource class: University::Person::Alumnus::Import, through: :current_university, through_association: :person_alumnus_imports @@ -30,11 +30,11 @@ class Admin::University::People::Alumni::ImportsController < Admin::University:: def breadcrumb super add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), - admin_university_people_alumni_path + admin_university_alumni_path add_breadcrumb University::Person::Alumnus::Import.model_name.human(count: 2), - admin_university_people_alumni_imports_path + admin_university_alumni_imports_path return unless @import - @import.persisted? ? add_breadcrumb(@import, admin_university_people_alumni_import_path(@import)) + @import.persisted? ? add_breadcrumb(@import, admin_university_alumni_import_path(@import)) : add_breadcrumb(t('create')) end diff --git a/app/controllers/admin/university/people/alumni_controller.rb b/app/controllers/admin/university/alumni_controller.rb similarity index 53% rename from app/controllers/admin/university/people/alumni_controller.rb rename to app/controllers/admin/university/alumni_controller.rb index 0123d44b7918016c381292720043a467928263dc..ae1f4a38b11069de87c3ec4130ef6deb57147fd9 100644 --- a/app/controllers/admin/university/people/alumni_controller.rb +++ b/app/controllers/admin/university/alumni_controller.rb @@ -1,9 +1,11 @@ -class Admin::University::People::AlumniController < Admin::University::ApplicationController +class Admin::University::AlumniController < Admin::University::ApplicationController load_and_authorize_resource class: University::Person::Alumnus, through: :current_university, through_association: :people has_scope :for_search_term + has_scope :for_alumni_program + has_scope :for_alumni_year def index @alumni = apply_scopes(@alumni).alumni @@ -24,15 +26,14 @@ class Admin::University::People::AlumniController < Admin::University::Applicati end def update_cohorts - # TODO - # if @alumnus.update(alumnus_params) - # redirect_to [:admin, @alumnus], - # notice: t('admin.successfully_updated_html', model: @alumnus.to_s) - # else - # render :edit - # breadcrumb - # add_breadcrumb t('edit') - # end + if @alumnus.update(alumnus_params) + redirect_to admin_university_alumnus_path(@alumnus), + notice: t('admin.successfully_updated_html', model: @alumnus.to_s) + else + render :edit_cohorts + breadcrumb + add_breadcrumb t('edit') + end end protected @@ -40,13 +41,12 @@ class Admin::University::People::AlumniController < Admin::University::Applicati def breadcrumb super add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), - admin_university_people_alumni_path - add_breadcrumb @alumnus, admin_university_person_alumnus_path(@alumnus) if @alumnus + admin_university_alumni_path + add_breadcrumb @alumnus, admin_university_alumni_path(@alumnus) if @alumnus end def alumnus_params - # TODO: Permit nested attrs - params.require(:university_person_alumnus) - .permit() + params.require(:university_person) + .permit(cohorts_attributes: [:id, :program_id, :university_id, :year, :_destroy]) end end diff --git a/app/models/communication/block/template/file.rb b/app/models/communication/block/template/file.rb index 8323b3d853c466db22d20843fb24aba231555a24..ad69e9defef42badfa25b1147eb4ef2f2981d7f2 100644 --- a/app/models/communication/block/template/file.rb +++ b/app/models/communication/block/template/file.rb @@ -1,6 +1,8 @@ class Communication::Block::Template::File < Communication::Block::Template def build_git_dependencies - add_dependency active_storage_blobs + files.each do |file| + add_dependency file.blob + end end def files diff --git a/app/models/education/academic_year.rb b/app/models/education/academic_year.rb index 1002b03ca63e9d986888824cad6626c982ea0971..50c9e240d00ac98b6734aea0da0cd61d465ce05c 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, @@ -33,6 +32,8 @@ class Education::AcademicYear < ApplicationRecord class_name: 'University::Person', through: :cohorts + validates :year, numericality: { only_integer: true, greater_than: 0 } + scope :ordered, -> { order(year: :desc) } def cohorts_in_context(context) diff --git a/app/models/education/cohort.rb b/app/models/education/cohort.rb index b513e77a815caf8378d5b7c9ddd59dd5331441d8..a60997c58b75764a579e99c655c531d6cb0817a7 100644 --- a/app/models/education/cohort.rb +++ b/app/models/education/cohort.rb @@ -27,17 +27,21 @@ class Education::Cohort < ApplicationRecord belongs_to :program, class_name: 'Education::Program' - alias_attribute :education_program, :program + alias_attribute :education_program, :program belongs_to :academic_year, class_name: 'Education::AcademicYear' - alias_attribute :education_academic_year, :academic_year + alias_attribute :education_academic_year, :academic_year has_and_belongs_to_many :people, class_name: 'University::Person', foreign_key: 'education_cohort_id', association_foreign_key: 'university_person_id' + validates_associated :academic_year, :program + validates :year, presence: true + before_validation :set_university_id, on: :create + scope :ordered, -> { includes(:academic_year).order('education_academic_years.year DESC') } @@ -45,4 +49,18 @@ class Education::Cohort < ApplicationRecord def to_s "#{program} #{academic_year} #{name}" end + + def year + academic_year&.year + end + + def year=(val) + self.academic_year = Education::AcademicYear.where(university_id: university_id, year: val).first_or_create + end + + private + + def set_university_id + self.university_id = self.program.university_id + end end diff --git a/app/models/university/person/with_education.rb b/app/models/university/person/with_education.rb index a42f499dbab3d54be47ae8b2894201cf5c90977a..978a9ed23be1e834177beeb87e09d174299c40ce 100644 --- a/app/models/university/person/with_education.rb +++ b/app/models/university/person/with_education.rb @@ -21,7 +21,7 @@ module University::Person::WithEducation has_many :experiences has_and_belongs_to_many :cohorts, - class_name: 'Education::Cohort', + class_name: '::Education::Cohort', foreign_key: 'university_person_id', association_foreign_key: 'education_cohort_id' @@ -38,6 +38,19 @@ module University::Person::WithEducation class_name: 'Education::Program', foreign_key: 'university_person_id', association_foreign_key: 'education_program_id' + + scope :for_alumni_program, -> (program_id) { + left_joins(:cohorts) + .where(education_cohorts: { program_id: program_id }) + .select("university_people.*") + .distinct + } + scope :for_alumni_year, -> (academic_year_id) { + left_joins(:cohorts) + .where(education_cohorts: { academic_year_id: academic_year_id }) + .select("university_people.*") + .distinct + } end def add_to_cohort(cohort) diff --git a/app/services/filters/admin/communication/extranets.rb b/app/services/filters/admin/communication/extranets.rb index 059f47780f5044617515a9d2623f05a241845466..b91877418a18cbf010c865728ddc6061aa14970b 100644 --- a/app/services/filters/admin/communication/extranets.rb +++ b/app/services/filters/admin/communication/extranets.rb @@ -3,7 +3,9 @@ module Filters def initialize(user) super add_search - add :for_about_type, ::Communication::Extranet::about_types.compact.map { |r| { to_s: I18n.t("activerecord.attributes.communication/extranet.about_#{r}"), id: r } }, I18n.t('filters.attributes.kind') + add :for_about_type, + ::Communication::Extranet::about_types.compact.map { |r| { to_s: I18n.t("activerecord.attributes.communication/extranet.about_#{r}"), id: r } }, + I18n.t('filters.attributes.kind') end end end diff --git a/app/services/filters/admin/communication/website/posts.rb b/app/services/filters/admin/communication/website/posts.rb index 30559c526a843071b6d0eeae0caf055b38b20c77..634ee13591b2ca64d6aad1098ef5f97bc5f16351 100644 --- a/app/services/filters/admin/communication/website/posts.rb +++ b/app/services/filters/admin/communication/website/posts.rb @@ -3,9 +3,26 @@ module Filters def initialize(user, website) super(user) add_search - add :for_author, website.authors.ordered, I18n.t('filters.attributes.element', element: I18n.t('activerecord.attributes.communication/website/post.author').downcase) - add :for_category, website.categories, I18n.t('filters.attributes.element', element: I18n.t('activerecord.models.communication/website/category.one').downcase), false, true - add :for_pinned, [{ to_s: I18n.t('true'), id: 'true' }, { to_s: I18n.t('false'), id: 'false' }], I18n.t('filters.attributes.element', element: I18n.t('admin.communication.website.post.pinned_status').downcase) + add :for_author, + website.authors.ordered, + I18n.t( + 'filters.attributes.element', + element: I18n.t('activerecord.attributes.communication/website/post.author').downcase + ) + add :for_category, + website.categories, + I18n.t( + 'filters.attributes.element', + element: Communication::Website::Category.model_name.human.downcase + ), + false, + true + add :for_pinned, + [{ to_s: I18n.t('true'), id: 'true' }, { to_s: I18n.t('false'), id: 'false' }], + I18n.t( + 'filters.attributes.element', + element: I18n.t('admin.communication.website.post.pinned_status').downcase + ) end end end diff --git a/app/services/filters/admin/communication/websites.rb b/app/services/filters/admin/communication/websites.rb index 4f43797b3ddf3924495f9db791f6551c85fa71f2..418264cccc218644883880bb7444c46b05a55e4e 100644 --- a/app/services/filters/admin/communication/websites.rb +++ b/app/services/filters/admin/communication/websites.rb @@ -3,7 +3,9 @@ module Filters def initialize(user) super add_search - add :for_about_type, ::Communication::Website::about_types.compact.map { |r| { to_s: I18n.t("activerecord.attributes.communication/website.about_#{r}"), id: r } }, I18n.t('filters.attributes.kind') + add :for_about_type, + ::Communication::Website::about_types.compact.map { |r| { to_s: I18n.t("activerecord.attributes.communication/website.about_#{r}"), id: r } }, + I18n.t('filters.attributes.kind') end end end diff --git a/app/services/filters/admin/education/programs.rb b/app/services/filters/admin/education/programs.rb index 5680fa3aca700bf39c6fbb07d677c925fdad5843..e6eb599cb12ec41ddc99c510e890020d8c19375f 100644 --- a/app/services/filters/admin/education/programs.rb +++ b/app/services/filters/admin/education/programs.rb @@ -7,10 +7,8 @@ module Filters user.university.education_diplomas, I18n.t( 'filters.attributes.element', - element: I18n.t('activerecord.models.education/diploma.one').downcase - ), - false, - false + element: Education::Diploma.model_name.human.downcase + ) end end end diff --git a/app/services/filters/admin/education/schools.rb b/app/services/filters/admin/education/schools.rb index 89712eb5732d29ec356026e3d1a670535a3c0ebc..ab5c6070e671656ec3fdf73023e6e97dacff4875 100644 --- a/app/services/filters/admin/education/schools.rb +++ b/app/services/filters/admin/education/schools.rb @@ -7,7 +7,7 @@ module Filters user.university.education_programs, I18n.t( 'filters.attributes.element', - element: I18n.t('activerecord.models.education/program.one').downcase + element: Education::Program.model_name.human.downcase ), false, true diff --git a/app/services/filters/admin/education/teachers.rb b/app/services/filters/admin/education/teachers.rb index a6f2a0c04a84c4992a29a71e4bd3907d0c764d23..f7367c36ee391979fb18ae6c9d88baf2a20a91f4 100644 --- a/app/services/filters/admin/education/teachers.rb +++ b/app/services/filters/admin/education/teachers.rb @@ -7,7 +7,7 @@ module Filters user.university.education_programs, I18n.t( 'filters.attributes.element', - element: I18n.t('activerecord.models.education/program.one').downcase + element: Education::Program.model_name.human.downcase ), false, true diff --git a/app/services/filters/admin/university/alumni.rb b/app/services/filters/admin/university/alumni.rb new file mode 100644 index 0000000000000000000000000000000000000000..ad0f53c253ed0112cf31160e47c89b0a43518019 --- /dev/null +++ b/app/services/filters/admin/university/alumni.rb @@ -0,0 +1,22 @@ +module Filters + class Admin::University::Alumni < Filters::Base + def initialize(user) + super + add_search + add :for_alumni_program, + user.university.education_programs, + I18n.t( + 'filters.attributes.element', + element: Education::Program.model_name.human.downcase + ), + false, + true + add :for_alumni_year, + user.university.academic_years.ordered, + I18n.t( + 'filters.attributes.element', + element: Education::AcademicYear.model_name.human.downcase + ) + end + end +end diff --git a/app/services/filters/admin/university/organizations.rb b/app/services/filters/admin/university/organizations.rb index 85b22cef389ebb90507853371f0deb8f3076ba98..bfd4cbb4f71f712f85ffec85ed951710781bc7db 100644 --- a/app/services/filters/admin/university/organizations.rb +++ b/app/services/filters/admin/university/organizations.rb @@ -3,7 +3,9 @@ module Filters def initialize(user) super add_search - add :for_kind, ::University::Organization::kinds.keys.map { |r| { to_s: I18n.t("enums.university.organization.kind.#{r}"), id: r } }, I18n.t('filters.attributes.kind') + add :for_kind, + ::University::Organization::kinds.keys.map { |r| { to_s: I18n.t("enums.university.organization.kind.#{r}"), id: r } }, + I18n.t('filters.attributes.kind') end end end diff --git a/app/services/filters/admin/university/people.rb b/app/services/filters/admin/university/people.rb index 515697eafa3b0dc4ec161cd5d6715c283f5d9e02..138f8291dd3e6557dc484137732a2ac52b7c9f5c 100644 --- a/app/services/filters/admin/university/people.rb +++ b/app/services/filters/admin/university/people.rb @@ -3,7 +3,9 @@ module Filters def initialize(user) super add_search - add :for_role, ::University::Person::LIST_OF_ROLES.map { |r| { to_s: I18n.t("activerecord.attributes.university/person.#{r}"), id: r } }, I18n.t('filters.attributes.role') + add :for_role, + ::University::Person::LIST_OF_ROLES.map { |r| { to_s: I18n.t("activerecord.attributes.university/person.#{r}"), id: r } }, + I18n.t('filters.attributes.role') end end end diff --git a/app/services/filters/admin/university/person/alumni.rb b/app/services/filters/admin/university/person/alumni.rb deleted file mode 100644 index 923f4c5f45fb560f95e47258b0de10399b0c76d4..0000000000000000000000000000000000000000 --- a/app/services/filters/admin/university/person/alumni.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Filters - class Admin::University::Person::Alumni < Filters::Base - def initialize(user) - super - add_search - end - end -end diff --git a/app/services/filters/admin/users.rb b/app/services/filters/admin/users.rb index bc431fa8eccedc0ecb727251214081bd884eeb65..5438038118677358d22fd77657476ee056b5660c 100644 --- a/app/services/filters/admin/users.rb +++ b/app/services/filters/admin/users.rb @@ -3,7 +3,9 @@ module Filters def initialize(user) super add_search - add :for_role, ::User.roles.keys.map { |r| { to_s: I18n.t("activerecord.attributes.user.roles.#{r}"), id: r } }, I18n.t('filters.attributes.role') + add :for_role, + ::User.roles.keys.map { |r| { to_s: I18n.t("activerecord.attributes.user.roles.#{r}"), id: r } }, + I18n.t('filters.attributes.role') end end end diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb index 63b1e92a60f37ad2e251e1f0a67f85a3c0c84c79..c2c514ca009cbb50c034c1ecaddcd88584190d0d 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb @@ -9,16 +9,16 @@ <% end %> button: text: >- - <%= prepare_text_for_static block.template.button %> + <%= prepare_text_for_static block.template.button, 5 %> url: >- - <%= prepare_text_for_static block.template.url %> + <%= prepare_text_for_static block.template.url, 5 %> button_secondary: text: >- - <%= prepare_text_for_static block.template.button_secondary %> + <%= prepare_text_for_static block.template.button_secondary, 5 %> url: >- - <%= prepare_text_for_static block.template.url_secondary %> + <%= prepare_text_for_static block.template.url_secondary, 5 %> button_tertiary: text: >- - <%= prepare_text_for_static block.template.button_tertiary %> + <%= prepare_text_for_static block.template.button_tertiary, 5 %> url: >- - <%= prepare_text_for_static block.template.url_tertiary %> + <%= prepare_text_for_static block.template.url_tertiary, 5 %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb index 88441ae9d4da5f2713df035cbb7914ad75839f0c..8a0c1c28a82294b38c603f4692bdccf7f626fa5b 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -3,10 +3,10 @@ - id: "<%= image.blob.id %>" file: "<%= image.blob.id %>" alt: > - <%= prepare_text_for_static image.alt %> + <%= prepare_text_for_static image.alt, 6 %> credit: > - <%= prepare_text_for_static image.credit %> + <%= prepare_text_for_static image.credit, 6 %> text: > - <%= prepare_text_for_static image.text %> + <%= prepare_text_for_static image.text, 6 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb index 6dabd797f8028d2a0af53ff8e686a9fd489da0ed..95c784ff68ace980e99b7ea580936961906298c3 100644 --- a/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/organization_chart/_static.html.erb @@ -2,6 +2,6 @@ block.template.persons_with_role.each do |person_with_role| person = person_with_role.person %> - slug: "<%= person.slug %>" - role: > - <%= prepare_text_for_static person_with_role.role %> + role: >- + <%= prepare_text_for_static person_with_role.role, 5 %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_static.html.erb b/app/views/admin/communication/blocks/templates/partners/_static.html.erb index 99397e04362a75c3392240f5edd4304d9362bd74..c9b3159170012285247e60bad2994e9ddb540fbd 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_static.html.erb @@ -3,9 +3,9 @@ - slug: "<%= partner.organization.slug %>" <% else %> - name: > - <%= prepare_text_for_static partner['name'] %> + <%= prepare_text_for_static partner['name'], 5 %> url: >- - <%= prepare_text_for_static partner['url'] %> + <%= prepare_text_for_static partner['url'], 5 %> logo: "<%= partner.blob&.id %>" <% end %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb index 865580f742e77697c9e460b683e3c68dbdddaf16..82dd7b3e10b3e39d6ab1256c85f46a5c26f6e452 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_static.html.erb @@ -1,11 +1,11 @@ testimonials: <% block.template.testimonials.each do |testimonial| %> - text: >- - <%= prepare_text_for_static testimonial.text %> + <%= prepare_text_for_static testimonial.text, 6 %> author: >- - <%= prepare_text_for_static testimonial.author %> + <%= prepare_text_for_static testimonial.author, 6 %> job: >- - <%= prepare_text_for_static testimonial.job %> + <%= prepare_text_for_static testimonial.job, 6 %> <% if testimonial.blob %> photo: "<%= testimonial.blob.id %>" <% end %> diff --git a/app/views/admin/communication/blocks/templates/video/_static.html.erb b/app/views/admin/communication/blocks/templates/video/_static.html.erb index 09979f74e45e1696e8450dc2082d31edf5e784c3..45ef27b113665687a3fc30a6daed6aab7678b4c8 100644 --- a/app/views/admin/communication/blocks/templates/video/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/video/_static.html.erb @@ -1,4 +1,4 @@ url: >- - <%= prepare_text_for_static block.template.url %> + <%= prepare_text_for_static block.template.url, 4 %> transcription: >- <%= prepare_text_for_static block.template.transcription, 4 %> diff --git a/app/views/admin/education/academic_years/_list.html.erb b/app/views/admin/education/academic_years/_list.html.erb index fb8a61ce54151f747be38153e0e62bcfa06b65ae..ab318d9dad3df35d28bc69c287f86a53c1e8f55c 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 a5cfbc21c4ccbc9346cbb264e1acfef9e9fe1c7e..a6410b0ffd811dcdabdf612b997c6d33b0d78da8 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 f6e8735f6c31f4662dc5380956e0d970ea36fdbc..c043e0c1506f19df53ce96dde779d1bc24229171 100644 --- a/app/views/admin/education/cohorts/show.html.erb +++ b/app/views/admin/education/cohorts/show.html.erb @@ -1,15 +1,18 @@ <% content_for :title, @cohort %> -<p> - <strong>Program:</strong> - <%= link_to @cohort.program, [:admin, @cohort.program] %> -</p> - -<p> - <strong>Academic year:</strong> - <%= link_to @cohort.academic_year, [:admin, @cohort.academic_year] %> -</p> +<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> + <h3 class="h5"><%= Education::Cohort.human_attribute_name('year') %></h3> + <p><%= link_to_if can?(:read, @cohort.academic_year), @cohort.academic_year, [:admin, @cohort.academic_year] %></p> + </div> + </div> + </div> +</div> <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> -<%= render 'admin/university/people/alumni/list', alumni: @cohort.people.ordered %> +<%= render 'admin/university/alumni/list', alumni: @cohort.people.ordered %> diff --git a/app/views/admin/education/diplomas/_list.html.erb b/app/views/admin/education/diplomas/_list.html.erb index e7adc544efca6f34d7256ee8b0c5d22695b5a1f2..dd55353b3b6bced66b141dc9a6c66ef18832130f 100644 --- a/app/views/admin/education/diplomas/_list.html.erb +++ b/app/views/admin/education/diplomas/_list.html.erb @@ -3,6 +3,7 @@ <tr> <th><%= Education::Diploma.human_attribute_name('name') %></th> <th><%= Education::Diploma.human_attribute_name('short_name') %></th> + <th><%= Education::Diploma.human_attribute_name('ects') %></th> <th><%= Education::Diploma.human_attribute_name('level') %></th> <th><%= Education::Diploma.human_attribute_name('programs') %></th> <th></th> @@ -13,6 +14,7 @@ <tr> <td><%= link_to diploma, [:admin, diploma] %></td> <td><%= diploma.short_name %></td> + <td><%= diploma.ects %></td> <td><%= diploma.level_i18n %></td> <td><%= diploma.programs.count %></td> <td class="text-end"> diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb index e0ca041da5dc6b06ef4292e9778105906b056ee6..5f0dadeff9a8fbf326b53c4bd6b6f738bb067ce5 100644 --- a/app/views/admin/education/diplomas/static.html.erb +++ b/app/views/admin/education/diplomas/static.html.erb @@ -3,4 +3,8 @@ title: > <%= @about.name %> short_name: > <%= @about.short_name %> +level: <%= @about.level_i18n %> +ects: <%= @about.ects %> +duration: > + <%= prepare_text_for_static @about.duration %> --- diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 1d9160ea01fad1755da2fb72171f06bad4ebdf10..caa4fcc189268ab0a8ff1d1fd086b08b980ce05d 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -42,14 +42,11 @@ roles: roles: [] <% end %> continuing: <%= @about.continuing %> -level: <%= @about.diploma&.level %> -ects: <%= @about.diploma&.ects %> <% [ :accessibility, :contacts, :content, - :duration, :evaluation, :objectives, :opportunities, diff --git a/app/views/admin/university/people/alumni/_cohort_fields.html.erb b/app/views/admin/university/alumni/_cohort_fields.html.erb similarity index 72% rename from app/views/admin/university/people/alumni/_cohort_fields.html.erb rename to app/views/admin/university/alumni/_cohort_fields.html.erb index bf6e5f83490f73d5864f5f755f2ff14ad497483d..632f02976117be7297d2e905c93f94dd629e4981 100644 --- a/app/views/admin/university/people/alumni/_cohort_fields.html.erb +++ b/app/views/admin/university/alumni/_cohort_fields.html.erb @@ -4,6 +4,10 @@ <div class="card-body"> <div class="row"> <div class="col-md-5"> + <%= f.input :university_id, + as: :hidden, + input_html: { value: current_university.id }, + wrapper: false %> <%= f.association :program, collection: collection_tree(current_university.education_programs), label_method: ->(p) { sanitize p[:label] }, @@ -14,10 +18,12 @@ wrapper: false %> </div> <div class="col-md-6"> - <%#= f.input :description, - as: :string, + <%= f.input :year, + as: :select, + collection: ((Time.now.year + 5).downto(1950)), label: false, - placeholder: University::Person::Involvement.human_attribute_name('description'), + include_blank: t('simple_form.include_blanks.defaults.year'), + required: true, wrapper: false %> </div> <div class="col-md-1 text-end"> diff --git a/app/views/admin/university/people/alumni/_list.html.erb b/app/views/admin/university/alumni/_list.html.erb similarity index 87% rename from app/views/admin/university/people/alumni/_list.html.erb rename to app/views/admin/university/alumni/_list.html.erb index 00f837195a83c7a68cbd084a275fdb91b6cc116f..e8676343406419cacc52936259be44191a1fc8ca 100644 --- a/app/views/admin/university/people/alumni/_list.html.erb +++ b/app/views/admin/university/alumni/_list.html.erb @@ -7,7 +7,7 @@ </thead> <tbody> <% alumni.each do |alumnus| %> - <% path = admin_university_people_alumnus_path(alumnus) %> + <% path = admin_university_alumnus_path(alumnus) %> <tr> <td><%= link_to alumnus.last_name, path %></td> <td><%= link_to alumnus.first_name, path %></td> diff --git a/app/views/admin/university/people/alumni/edit_cohorts.html.erb b/app/views/admin/university/alumni/edit_cohorts.html.erb similarity index 76% rename from app/views/admin/university/people/alumni/edit_cohorts.html.erb rename to app/views/admin/university/alumni/edit_cohorts.html.erb index 5cc53c3ef5f2efd63a0a5ade2d1527f03e620565..ea332608a5f07d98cbd8af1d4797073b4af5b2fb 100644 --- a/app/views/admin/university/people/alumni/edit_cohorts.html.erb +++ b/app/views/admin/university/alumni/edit_cohorts.html.erb @@ -2,7 +2,7 @@ <h2 class="h3"><%= Education::Program.model_name.human(count: 2) %></h2> -<%= simple_form_for [:admin, @alumnus], url: edit_cohorts_admin_university_person_alumnus_path(@alumnus) do |f| %> +<%= simple_form_for [:admin, @alumnus], url: edit_cohorts_admin_university_alumnus_path(@alumnus) do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> @@ -20,8 +20,8 @@ <div class="col-md-10"> <div id="cohorts"> - <%= f.simple_fields_for :cohorts, @alumnus.cohorts.ordered, include_id: false do |cohort_f| %> - <%= render 'admin/university/person/alumni/cohort_fields', f: cohort_f, include_id: true %> + <%= f.simple_fields_for :cohorts, @alumnus.cohorts.sort_by { |c| [c.year ? 0 : 1, c.year] }.reverse, include_id: false do |cohort_f| %> + <%= render 'admin/university/alumni/cohort_fields', f: cohort_f, include_id: true %> <% end %> </div> </div> diff --git a/app/views/admin/university/people/alumni/imports/index.html.erb b/app/views/admin/university/alumni/imports/index.html.erb similarity index 77% rename from app/views/admin/university/people/alumni/imports/index.html.erb rename to app/views/admin/university/alumni/imports/index.html.erb index a376df884a90ed95082a50df1e2f79464414da1d..e48aa45f47054e8801ebd5f80b4619903487e9c9 100644 --- a/app/views/admin/university/people/alumni/imports/index.html.erb +++ b/app/views/admin/university/alumni/imports/index.html.erb @@ -9,7 +9,7 @@ <tbody> <% @imports.each do |import| %> <tr> - <td><%= link_to import, admin_university_people_alumni_import_path(import) %></td> + <td><%= link_to import, admin_university_alumni_import_path(import) %></td> </tr> <% end %> </tbody> @@ -18,6 +18,6 @@ <% content_for :action_bar_right do %> <%= link_to_if can?(:create, University::Person::Alumnus::Import), t('create'), - new_admin_university_people_alumni_import_path, + new_admin_university_alumni_import_path, class: button_classes %> <% end %> diff --git a/app/views/admin/university/people/alumni/imports/new.html.erb b/app/views/admin/university/alumni/imports/new.html.erb similarity index 97% rename from app/views/admin/university/people/alumni/imports/new.html.erb rename to app/views/admin/university/alumni/imports/new.html.erb index 0749b75c5c3696a0b5d5dcf89b0d934cde8826b9..84e9abb84c5048841d2a70a1f553647f45a12ad0 100644 --- a/app/views/admin/university/people/alumni/imports/new.html.erb +++ b/app/views/admin/university/alumni/imports/new.html.erb @@ -11,7 +11,7 @@ Les valeurs pour gender peuvent être m (masculin), f (féminin) et n (non binaire). </p> <%= simple_form_for @import, - url: admin_university_people_alumni_imports_path do |f| %> + url: admin_university_alumni_imports_path do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> diff --git a/app/views/admin/university/people/alumni/imports/show.html.erb b/app/views/admin/university/alumni/imports/show.html.erb similarity index 100% rename from app/views/admin/university/people/alumni/imports/show.html.erb rename to app/views/admin/university/alumni/imports/show.html.erb diff --git a/app/views/admin/university/people/alumni/index.html.erb b/app/views/admin/university/alumni/index.html.erb similarity index 67% rename from app/views/admin/university/people/alumni/index.html.erb rename to app/views/admin/university/alumni/index.html.erb index dc53377d88626440dd47ff45d7e1de84e81eb234..6db0169c7ec860444e7629410ef2484f7cbfb63e 100644 --- a/app/views/admin/university/people/alumni/index.html.erb +++ b/app/views/admin/university/alumni/index.html.erb @@ -1,14 +1,14 @@ <% content_for :title, "#{University::Person::Alumnus.model_name.human(count: 2)} (#{@alumni.total_count})" %> -<%= render 'filters', current_path: admin_university_people_alumni_path, filters: @filters if @filters.any? %> +<%= render 'filters', current_path: admin_university_alumni_path, filters: @filters if @filters.any? %> -<%= render 'admin/university/people/alumni/list', alumni: @alumni %> +<%= render 'admin/university/alumni/list', alumni: @alumni %> <%= paginate @alumni, theme: 'bootstrap-5' %> <% content_for :action_bar_left do %> <%= link_to t('import'), - new_admin_university_people_alumni_import_path, + new_admin_university_alumni_import_path, class: button_classes if can? :manage, University::Person::Alumnus::Import %> <% end %> diff --git a/app/views/admin/university/people/alumni/new.html.erb b/app/views/admin/university/alumni/new.html.erb similarity index 100% rename from app/views/admin/university/people/alumni/new.html.erb rename to app/views/admin/university/alumni/new.html.erb diff --git a/app/views/admin/university/alumni/show.html.erb b/app/views/admin/university/alumni/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c122295e9ef3ad42c37457d47f6a4a3f50faeb2c --- /dev/null +++ b/app/views/admin/university/alumni/show.html.erb @@ -0,0 +1,24 @@ +<% content_for :title, @alumnus %> + +<%= render 'admin/university/people/main_infos', person: @alumnus %> + +<% if @alumnus.cohorts.any? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h2 class="card-title mb-0 h5"><%= Education::Cohort.model_name.human(count: @alumnus.cohorts.count) %></h2> + </div> + <div class="card-body"> + <ul class="list-unstyled"> + <% @alumnus.cohorts.ordered.each do |cohort| %> + <li><%= link_to cohort, [:admin, cohort] %></li> + <% end %> + </ul> + </div> + </div> +<% end %> + + +<% content_for :action_bar_right do %> + <%= edit_link @alumnus %> + <%= link_to t('university.manage_cohorts'), edit_cohorts_admin_university_alumnus_path(@alumnus), class: button_classes if can?(:update, @alumnus) %> +<% end %> diff --git a/app/views/admin/university/people/alumni/show.html.erb b/app/views/admin/university/people/alumni/show.html.erb deleted file mode 100644 index 7ee7ad53cacea6d9e59e955a00060cd783f08542..0000000000000000000000000000000000000000 --- a/app/views/admin/university/people/alumni/show.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<% content_for :title, @alumnus %> - -<%= render 'admin/university/people/main_infos', person: @alumnus %> - -<%= render 'admin/university/person/alumni/show/cohorts', cohorts: @cohorts, param_name: 'cohorts_page' %> - -<%# TODO: remove %> -<% if @alumnus.cohorts.any? %> -<h2><%= Education::Cohort.model_name.human(count: @alumnus.cohorts.count) %></h2> -<% @alumnus.cohorts.each do |cohort| %> - <%= link_to cohort, [:admin, cohort] %> -<% end %> -<% end %> -<%# end TODO %> - - -<% content_for :action_bar_right do %> - <%= edit_link @alumnus %> - <%= link_to t('university.manage_cohorts'), edit_cohorts_admin_university_person_alumnus_path(@alumnus), class: button_classes if can?(:update, @alumnus) %> -<% end %> diff --git a/app/views/admin/university/people/alumni/show/_cohorts.html.erb b/app/views/admin/university/people/alumni/show/_cohorts.html.erb deleted file mode 100644 index a85f73d8abd631a2d1f123591a450c97508de44c..0000000000000000000000000000000000000000 --- a/app/views/admin/university/people/alumni/show/_cohorts.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -<% param_name ||= :page %> - -<% if cohorts.total_count > 0 %> - <div class="card"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= "#{Education::Cohort.model_name.human(count: 2)} (#{cohorts.total_count})" %></h2> - </div> - <table class="table"> - <thead> - <tr> - <th><%= Education::Cohort.human_attribute_name('program') %></th> - <th><%= Education::Cohort.human_attribute_name('academic_year') %></th> - <th></th> - </tr> - </thead> - <tbody> - <% cohorts.each do |cohort| %> - <% program = cohort.program %> - <tr> - <td><%= link_to_if can?(:read, program), program, [:admin, program] %></td> - <td><%= program.level_i18n %></td> - <td><%= cohort.academic_year %></td> - <td class="text-end"> - <div class="btn-group" role="group"> - <%= link_to t('edit'), - '#', - class: button_classes if can?(:update, cohort) %> - <%= link_to t('delete'), - '#', - method: :delete, - data: { confirm: t('please_confirm') }, - class: button_classes_danger if can?(:destroy, cohort) %> - </div> - </td> - </tr> - <% end %> - </tbody> - </table> - - <% if cohorts.total_pages > 1 %> - <div class="card-footer"> - <%= paginate cohorts, theme: 'bootstrap-5', param_name: param_name %> - </div> - <% end %> - - </div> - -<% end %> diff --git a/config/admin_navigation.rb b/config/admin_navigation.rb index f0f93fb026a2c084af78360b79efb881c601975a..a319d52b18a4f3a237653cba2131d994e6fe39d7 100644 --- a/config/admin_navigation.rb +++ b/config/admin_navigation.rb @@ -6,11 +6,11 @@ SimpleNavigation::Configuration.run do |navigation| navigation.items do |primary| primary.item :dashboard, t('admin.dashboard'), admin_root_path, { icon: 'tachometer-alt', highlights_on: /admin$/ } - if can?(:read, User) || can?(:read, University::Person) || can?(:read, University::Organization) + if can?(:read, University::Person) || can?(:read, University::Organization) 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_people_alumni_path, { icon: 'users' } + primary.item :university, University::Person.model_name.human(count: 2), admin_university_people_path, { icon: 'users-cog' } if can?(:read, University::Person) + primary.item :university, University::Organization.model_name.human(count: 2), admin_university_organizations_path, { icon: 'building' } if can?(:read, University::Organization) + primary.item :communication_alumni, University::Person::Alumnus.model_name.human(count: 2), admin_university_alumni_path, { icon: 'users' } if can?(:read, University::Person) end if can?(:read, Education::Program) diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 3733fcfe16c790e762a09fc0d1dbea29ed507088..e83ec1619925852f0974c3692cc7f9570885530e 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -20,9 +20,12 @@ en: one: School other: Schools attributes: - education/cohort: + education/academic_year: year: Year + education/cohort: alumni: Alumni + program: Program + year: Year education/diploma: name: Name short_name: Short name diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index ecd791e55169fec76e93ee6e8ee9c4fc942929df..1c657a83016d3269dec0c90c9042cfff7aa43c70 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -20,9 +20,12 @@ fr: one: École other: Écoles attributes: - education/cohort: + education/academic_year: year: Année + education/cohort: alumni: Alumni + program: Formation + year: Année education/diploma: name: Nom short_name: Nom abrégé diff --git a/config/locales/university/en.yml b/config/locales/university/en.yml index c453abf00418bc7e77e019f9085367b8a6489e92..6de579a94b3757e9ee037e4de09bc694fe85c1ad 100644 --- a/config/locales/university/en.yml +++ b/config/locales/university/en.yml @@ -129,6 +129,9 @@ en: linkedin: "Example: https://www.linkedin.com/in/osuny" tenure: "To differ from temporary lecturer." twitter: "Example: osuny" + include_blanks: + defaults: + year: Select year enums: university: organization: diff --git a/config/locales/university/fr.yml b/config/locales/university/fr.yml index 00d4d9d976dc08d43ea41a3fc9b10f81d79827a8..af72d52d27263c1fea9d70bd08509b8f68cb6ebc 100644 --- a/config/locales/university/fr.yml +++ b/config/locales/university/fr.yml @@ -129,6 +129,9 @@ fr: linkedin: "Exemple : https://www.linkedin.com/in/osuny" tenure: "À différencier d'une personne vacataire." twitter: "Exemple : osuny" + include_blanks: + defaults: + year: Sélectionnez une année enums: university: organization: diff --git a/config/routes/admin/university.rb b/config/routes/admin/university.rb index 5106085dc6cb64aa953317c748c99e827750b6a1..8b8d2a3b5dafb9064928c2b76d84d7e06d98013a 100644 --- a/config/routes/admin/university.rb +++ b/config/routes/admin/university.rb @@ -3,17 +3,15 @@ namespace :university do namespace :organizations do resources :imports, only: [:index, :show, :new, :create] end - namespace :people do - namespace :alumni do - resources :imports, only: [:index, :show, :new, :create] - end - resources :alumni, only: [:index, :show] do - member do - get 'edit_cohorts' => 'alumni#edit_cohorts' - patch 'edit_cohorts' => 'alumni#update_cohorts' - get 'edit_experience' => 'alumni#edit_experiences' - patch 'edit_experiences' => 'alumni#update_experiences' - end + namespace :alumni do + resources :imports, only: [:index, :show, :new, :create] + end + resources :alumni, only: [:index, :show] do + member do + get 'edit_cohorts' => 'alumni#edit_cohorts' + patch 'edit_cohorts' => 'alumni#update_cohorts' + get 'edit_experience' => 'alumni#edit_experiences' + patch 'edit_experiences' => 'alumni#update_experiences' end end resources :people, :organizations diff --git a/db/schema.rb b/db/schema.rb index d213b5e573c90cdfbfe0321da42497c3b89500d6..931135610066d1d6eea271bcebf5a84074972d96 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -504,23 +504,6 @@ ActiveRecord::Schema.define(version: 2022_05_16_095044) 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" @@ -711,8 +694,8 @@ ActiveRecord::Schema.define(version: 2022_05_16_095044) 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