diff --git a/app/controllers/admin/education/diplomas_controller.rb b/app/controllers/admin/education/diplomas_controller.rb index 4fe3bd48b12947678b5689f9bcd6bced7dbb2511..c01478528f3ab6566f2ac222d1bd80e0e3c9359e 100644 --- a/app/controllers/admin/education/diplomas_controller.rb +++ b/app/controllers/admin/education/diplomas_controller.rb @@ -58,6 +58,6 @@ class Admin::Education::DiplomasController < Admin::Education::ApplicationContro def diploma_params params.require(:education_diploma) - .permit(:name, :short_name, :level) + .permit(:name, :short_name, :level, :ects, :duration) end end diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index a074a9d522c04c153b3839223b2524c88b573f02..d934aee75f0c2f0ec38103e27d18cc6857a8916b 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -98,9 +98,9 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def program_params params.require(:education_program).permit( - :name, :short_name, :slug, :level, :capacity, :ects, :continuing, :description, :published, + :name, :short_name, :slug, :level, :capacity, :continuing, :description, :published, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit, - :prerequisites, :objectives, :duration, :presentation, :registration, :pedagogy, :content, + :prerequisites, :objectives, :presentation, :registration, :pedagogy, :content, :evaluation, :accessibility, :pricing, :contacts, :opportunities, :results, :other, :main_information, :parent_id, :diploma_id, school_ids: [], university_person_involvements_attributes: [:id, :person_id, :description, :position, :_destroy] diff --git a/app/models/education/diploma.rb b/app/models/education/diploma.rb index dc0913ddd905e2dedf1396c3abc34f33fc27733a..cdbb4aef7261d6a3b0114f81078c919e171d80e2 100644 --- a/app/models/education/diploma.rb +++ b/app/models/education/diploma.rb @@ -3,6 +3,8 @@ # Table name: education_diplomas # # id :uuid not null, primary key +# duration :text +# ects :integer # level :integer default("not_applicable") # name :string # short_name :string @@ -24,7 +26,7 @@ class Education::Diploma < ApplicationRecord include WithGit include WithSlug - has_many :programs + has_many :programs, dependent: :nullify scope :ordered, -> { order(:level, :name) } @@ -47,15 +49,27 @@ class Education::Diploma < ApplicationRecord } end + def published_programs_for_website(website) + website.education_programs.published.where(diploma: self) + end + # We need to send the diplomas only to the websites that need them def for_website?(website) - website.education_programs.published.where(diploma: self).any? + published_programs_for_website(website).any? end def git_path(website) "content/diplomas/#{slug}/_index.html" end + def git_dependencies(website) + published_programs = published_programs_for_website(website) + + dependencies = [self] + dependencies += published_programs + published_programs.map(&:active_storage_blobs).flatten if published_programs.any? + dependencies + end + def to_s "#{name}" end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index e7fcc5e9aeee0d41aaadc0eb32a049d0c4f9dc6f..ec001f173341c6854b6033dcdfb165c6ff764bff 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -10,7 +10,6 @@ # continuing :boolean # description :text # duration :text -# ects :integer # evaluation :text # featured_image_alt :string # featured_image_credit :text @@ -211,7 +210,8 @@ class Education::Program < ApplicationRecord university_people_through_role_involvements + university_people_through_role_involvements.map(&:active_storage_blobs).flatten + university_people_through_role_involvements.map(&:administrator) + - website.menus + website.menus + + [diploma] end def git_destroy_dependencies(website) diff --git a/app/views/admin/education/diplomas/_form.html.erb b/app/views/admin/education/diplomas/_form.html.erb index a7580255abfc90ef1ccce28db929001cd6085f57..4caa4a7c6ede1d863c6cab9b347521fdf65115f3 100644 --- a/app/views/admin/education/diplomas/_form.html.erb +++ b/app/views/admin/education/diplomas/_form.html.erb @@ -16,6 +16,12 @@ <div class="col-lg-6"> <%= f.input :level, include_blank: false %> </div> + <div class="col-lg-6"> + <%= f.input :ects %> + </div> + <div class="col-lg-6"> + <%= f.input :duration, as: :string %> + </div> </div> </div> diff --git a/app/views/admin/education/diplomas/show.html.erb b/app/views/admin/education/diplomas/show.html.erb index 406d2fe7f118529fbf5f51628f614e7dd9b27f9f..8955a3fc549b3dc1089e2613c7fe355d4f1da02d 100644 --- a/app/views/admin/education/diplomas/show.html.erb +++ b/app/views/admin/education/diplomas/show.html.erb @@ -1,25 +1,40 @@ <% content_for :title, @diploma %> <div class="row"> - <div class="col-lg-6"> - <p> - <strong><%= Education::Diploma.human_attribute_name('short_name') %></strong> - <%= @diploma.short_name %> - </p> + <div class="col-lg-8"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h2 class="card-title mb-0 h5"> + <%= Education::Diploma.human_attribute_name('programs') %> + </h2> + </div> + <%= render 'admin/education/programs/list', + programs: @programs, + hide_diploma: true %> + </div> </div> - <div class="col-lg-6"> - <p> - <strong><%= Education::Diploma.human_attribute_name('level') %></strong> - <%= @diploma.level_i18n %> - </p> + <div class="col-lg-4"> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h2 class="card-title mb-0 h5"><%= t('information') %></h2> + </div> + <div class="card-body"> + <strong><%= Education::Diploma.human_attribute_name('short_name') %></strong> + <span class="float-end"><%= @diploma.short_name %></span> + <hr> + <strong><%= Education::Diploma.human_attribute_name('level') %></strong> + <span class="float-end"><%= @diploma.level_i18n %></span> + <hr> + <strong><%= Education::Diploma.human_attribute_name('ects') %></strong> + <span class="float-end"><%= @diploma.ects %></span> + <hr> + <strong><%= Education::Diploma.human_attribute_name('duration') %></strong> + <span class="float-end"><%= @diploma.duration %></span> + </div> + </div> </div> </div> - -<%= render 'admin/education/programs/list', - programs: @programs, - hide_diploma: true %> - <% content_for :action_bar_left do %> <%= destroy_link @diploma %> <% end %> diff --git a/app/views/admin/education/programs/_form.html.erb b/app/views/admin/education/programs/_form.html.erb index 3bdded14d767ff25e04e8c127fc668dd3fc71d54..84e03451d7368be7eb7304d67b8590f4d402c3d8 100644 --- a/app/views/admin/education/programs/_form.html.erb +++ b/app/views/admin/education/programs/_form.html.erb @@ -17,17 +17,13 @@ <div class="col-lg-6"> <%= f.association :diploma, collection: current_university.diplomas.ordered %> - <%= f.input :level, include_blank: false %> - <%= f.input :ects %> - <%= render 'admin/education/programs/forms/input_with_inheritance', - f: f, property: :duration %> + <%= f.association :schools, + as: :check_boxes, + collection: current_university.education_schools.ordered %> </div> <div class="col-lg-6"> <%= f.input :capacity %> <%= f.input :continuing %> - <%= f.association :schools, - as: :check_boxes, - collection: current_university.education_schools.ordered %> </div> </div> <% end %> diff --git a/app/views/admin/education/programs/_list.html.erb b/app/views/admin/education/programs/_list.html.erb index 58e29ae462f0048e9031a789e287b4afa81aa5e1..f6b9675b7bbfe935276fb176860ecc7acd2419b6 100644 --- a/app/views/admin/education/programs/_list.html.erb +++ b/app/views/admin/education/programs/_list.html.erb @@ -5,7 +5,7 @@ <table class="<%= table_classes %>"> <thead> <tr> - <th><%= Education::Program.model_name.human %></th> + <th><%= Education::Program.human_attribute_name('name') %></th> <% unless hide_diploma %> <th><%= Education::Program.human_attribute_name('diploma') %></th> <% end %> @@ -29,7 +29,7 @@ <% unless hide_parent %> <td><%= link_to_if can?(:read, parent), parent, [:admin, parent] if parent %></td> <% end %> - <td class="text-end pe-0"> + <td class="text-end"> <div class="btn-group" role="group"> <%= link_to t('edit'), edit_admin_education_program_path(program), diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 62633b0455335dd75a96eac7748155a4478a5b4c..799a76b173b9f7c7c66dd76954aacc8b706098fa 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -1,31 +1,7 @@ <% content_for :title, @program %> <div class="row"> - <div class="col-md-3"> - <%= render 'admin/education/programs/forms/part', part: :technical do %> - <h3 class="h5"><%= Education::Program.human_attribute_name('published') %></h3> - <p><%= t @program.published %></p> - <h3 class="h5"><%= Education::Program.human_attribute_name('slug') %></h3> - <p><%= @program.slug %></p> - <% if @program.parent %> - <h3 class="h5"><%= Education::Program.human_attribute_name('parent') %></h3> - <p><%= link_to @program.parent, [:admin, @program.parent] %></p> - <% end %> - <% end %> - <%= render 'admin/application/featured_image/show', about: @program %> - <% if @program.description.present? %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('seo') %></h5> - </div> - <div class="card-body"> - <h3 class="h5"><%= Education::Program.human_attribute_name('description') %></h3> - <%= simple_format @program.description %> - </div> - </div> - <% end %> - </div> - <div class="col-md-9"> + <div class="col-lg-8 col-xxl-9"> <%= render 'admin/education/programs/forms/part', part: :essential, collapsed: false do %> @@ -43,10 +19,6 @@ <%= Education::Program.human_attribute_name('level') %> </h3> <p><%= @program.level_i18n %></p> - <h3 class="h5 mt-4"> - <%= Education::Program.human_attribute_name('ects') %> - </h3> - <p><%= @program.ects %></p> <%= render 'admin/application/property/text', object: @program, property: :duration %> @@ -173,6 +145,30 @@ <%= render 'admin/education/programs/show/cohorts' %> </div> + <div class="col-lg-4 col-xxl-3"> + <%= render 'admin/education/programs/forms/part', part: :technical do %> + <h3 class="h5"><%= Education::Program.human_attribute_name('published') %></h3> + <p><%= t @program.published %></p> + <h3 class="h5"><%= Education::Program.human_attribute_name('slug') %></h3> + <p><%= @program.slug %></p> + <% if @program.parent %> + <h3 class="h5"><%= Education::Program.human_attribute_name('parent') %></h3> + <p><%= link_to @program.parent, [:admin, @program.parent] %></p> + <% end %> + <% end %> + <%= render 'admin/application/featured_image/show', about: @program %> + <% if @program.description.present? %> + <div class="card flex-fill w-100"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <h3 class="h5"><%= Education::Program.human_attribute_name('description') %></h3> + <%= simple_format @program.description %> + </div> + </div> + <% end %> + </div> </div> <% content_for :preview do %> diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index b5a0444f03857c663da78cb419ec4d37c0de2ee1..1d9160ea01fad1755da2fb72171f06bad4ebdf10 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -42,8 +42,8 @@ roles: roles: [] <% end %> continuing: <%= @about.continuing %> -level: <%= @about.level %> -ects: <%= @about.ects %> +level: <%= @about.diploma&.level %> +ects: <%= @about.diploma&.ects %> <% [ :accessibility, diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 4cd54e4b70e671944ab70327cd8a6dd1bd42c5ec..3733fcfe16c790e762a09fc0d1dbea29ed507088 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -28,6 +28,8 @@ en: short_name: Short name level: Level programs: Programs + duration: Duration + ects: ECTS education/program: accessibility: Accessibilité capacity: Capacity @@ -122,15 +124,18 @@ en: second_year: Second year simple_form: hints: + education_diploma: + ects: European Credits Transfer System + duration: Duration can be set as hours or days and it can be estimated. education_program: - capacity: Nombre de places disponibles par promotion + capacity: People per cohort ects: European Credits Transfer System - prerequisites: Préalables nécessaires ou indispensables pour bénéficier d'une prestation déterminée. L'absence de prérequis doit être mentionnée. - objectives: "Énoncé des aptitudes et compétences, visées et évaluables, qui seront acquises au cours de la prestation. Aptitude : capacité d'appliquer un savoir et d'utiliser un savoir-faire pour réaliser des tâches et résoudre des problèmes. Compétences : capacité avérée de mettre en œuvre des savoirs, des savoir-faire et des dispositions personnelles, sociales ou méthodologiques dans des situations de travail ou d’études/formations, pour le développement professionnel ou personnel." - duration: La durée peut être exprimée en heure ou en jour. Elle peut également être forfaitisée ou estimée. - registration: "Délai d’accès : durée estimée entre la demande du bénéficiaire et le début de la prestation." - pricing: Prix de la prestation ou conditions tarifaires. - pedagogy: Modalités pédagogiques et/ou moyens et/ou outils utilisés pour mener à bien la prestation dispensée. - evaluation: Moyens mobilisés pour me- surer à l'aide de critères objectifs les acquis du bénéficiaire en cours et/ou à la fin de la prestation. - accessibility: Conditions d'accueil et d’accès des publics en situation de handicap (locaux, adaptation des moyens de la prestation). + prerequisites: Necessary or indispensable prerequisites for a given service. The absence of prerequisites must be mentioned. + objectives: "A statement of the skills and competences, both targeted and assessable, that will be acquired during the performance. Ability: the ability to apply knowledge and use skills to complete tasks and solve problems. Competence: demonstrated ability to apply knowledge, skills and personal, social or methodological dispositions in work or study/training situations for professional or personal development." + duration: The duration can be expressed in hours or days. It can also be lumped or estimated. + registration: "Access time: estimated time between the beneficiary's application and the start of the service." + pricing: Price of the service or tariff conditions. + pedagogy: Teaching methods and/or means and/or tools used to carry out the service provided. + evaluation: Means mobilised to measure with objective criteria the beneficiary's achievements during and/or at the end of the service. + accessibility: Conditions of reception and access for people with disabilities (premises, adaptation of the means of provision). description: Plain text without HTML, dedicated to SEO diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index ecd5a58b3d1b8754fa7852b1542d63407a602a4d..ecd791e55169fec76e93ee6e8ee9c4fc942929df 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -28,6 +28,8 @@ fr: short_name: Nom abrégé level: Niveau programs: Formations + duration: Durée + ects: Crédits ECTS education/program: accessibility: Accessibilité capacity: Capacité @@ -140,6 +142,9 @@ fr: second_year: Bac + 2 simple_form: hints: + education_diploma: + ects: European Credits Transfer System + duration: La durée peut être exprimée en heure ou en jour. Elle peut également être forfaitisée ou estimée. education_program: capacity: Nombre de places disponibles par promotion ects: European Credits Transfer System diff --git a/db/migrate/20220516095044_add_fields_to_education_diplomas.rb b/db/migrate/20220516095044_add_fields_to_education_diplomas.rb new file mode 100644 index 0000000000000000000000000000000000000000..061d2e9e27e6e6eb545ce16a4ebf27ae1a677277 --- /dev/null +++ b/db/migrate/20220516095044_add_fields_to_education_diplomas.rb @@ -0,0 +1,7 @@ +class AddFieldsToEducationDiplomas < ActiveRecord::Migration[6.1] + def change + add_column :education_diplomas, :ects, :integer + add_column :education_diplomas, :duration, :text + remove_column :education_programs, :ects + end +end diff --git a/db/schema.rb b/db/schema.rb index 0968b7525eed32611fabd1a576e5dc7fa4e0a72c..d213b5e573c90cdfbfe0321da42497c3b89500d6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_05_15_082819) do +ActiveRecord::Schema.define(version: 2022_05_16_095044) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -427,6 +427,8 @@ ActiveRecord::Schema.define(version: 2022_05_15_082819) do t.uuid "university_id", null: false t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.integer "ects" + t.text "duration" t.index ["university_id"], name: "index_education_diplomas_on_university_id" end @@ -435,7 +437,6 @@ ActiveRecord::Schema.define(version: 2022_05_15_082819) do t.string "name" t.integer "level" t.integer "capacity" - t.integer "ects" t.boolean "continuing" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false diff --git a/test/fixtures/education/diplomas.yml b/test/fixtures/education/diplomas.yml index 6b5998c346801ef18c013f347cd6b1b88eca75d5..00700635aebd67e206d2cae946015c0eea4525d1 100644 --- a/test/fixtures/education/diplomas.yml +++ b/test/fixtures/education/diplomas.yml @@ -3,6 +3,8 @@ # Table name: education_diplomas # # id :uuid not null, primary key +# duration :text +# ects :integer # level :integer default("not_applicable") # name :string # short_name :string diff --git a/test/models/education/diploma_test.rb b/test/models/education/diploma_test.rb index 54396281497a71f21144c7b926b41be2ffcb793c..e3dfd30e0f55a7a2421d5be6bcf6dcd723b0120a 100644 --- a/test/models/education/diploma_test.rb +++ b/test/models/education/diploma_test.rb @@ -3,6 +3,8 @@ # Table name: education_diplomas # # id :uuid not null, primary key +# duration :text +# ects :integer # level :integer default("not_applicable") # name :string # short_name :string