diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index 546d58d45557e133ddad562abb13b1f93eb51591..66ea3f383d1ec9cb7a39e1feb9df1dd5c4723798 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -60,14 +60,15 @@ module Admin::ApplicationHelper raw "<a href=\"#{path}\" class=\"btn btn-light btn-xs\">#{t 'static' }</a>" end - def osuny_panel(title = nil, subtitle: nil, action: nil, image: nil, small: false, &block) + def osuny_panel(title = nil, subtitle: nil, action: nil, image: nil, small: false, classes: '', &block) render layout: "admin/layouts/themes/#{current_admin_theme}/panel", locals: { title: title, subtitle: subtitle, action: action, image: image, - small: small + small: small, + classes: classes } do capture(&block) end @@ -77,6 +78,10 @@ module Admin::ApplicationHelper raw "<label class=\"form-label #{classes}\">#{title}</label>" end + def osuny_separator + raw '<hr class="my-5">' + end + def if_appstack(string) return '' if current_admin_theme != 'appstack' " #{string}" diff --git a/app/models/education/program.rb b/app/models/education/program.rb index f3e01472f9a156b5baa4862a094283a7e104ec98..1237d1c98d7e0058cc1baa14c0b2e97bb66a7565 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -52,6 +52,7 @@ class Education::Program < ApplicationRecord include Aboutable include Sanitizable + include WithAccessibility include WithAlumni include WithBlobs include WithBlocks diff --git a/app/views/admin/communication/blocks/content/_editor.html.erb b/app/views/admin/communication/blocks/content/_editor.html.erb index cd7dc29d2f0d07f8c17d01ef301373d5f9f51291..ca5ecb2dbbe5d309c75c5f82989a65f106f87c80 100644 --- a/app/views/admin/communication/blocks/content/_editor.html.erb +++ b/app/views/admin/communication/blocks/content/_editor.html.erb @@ -1,4 +1,4 @@ -<div class="js-content-editor" +<div class="js-content-editor mb-5" data-sort-blocks-url="<%= reorder_admin_communication_blocks_path(lang: nil, website_id: nil, extranet_id: nil) %>" data-sort-headings-url="<%= reorder_admin_communication_headings_path(lang: nil, website_id: nil, extranet_id: nil) %>"> <div class=" content-editor__elements diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 24978c47fa5d2d16d8d3a3f44f226065dfd90d03..e14daa326e7765ab2d13276e802582ff3e700eae 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -1,11 +1,29 @@ <% content_for :title, @page %> <%= render 'admin/communication/websites/sidebar' do %> - <%= render 'admin/communication/websites/pages/show/heading' %> - <hr class="my-5"> + <div class="row"> + <div class="col-lg-7"> + <%= osuny_panel Communication::Website::Page.human_attribute_name(:title), small: true do %> + <p class="lead"><%= @page.title %></p> + <% end %> + </div> + <div class="offset-lg-1 col-lg-4"> + <%= render 'admin/application/featured_image/show', about: @page, small: true %> + </div> + </div> + <%= osuny_separator %> <%= render 'admin/application/a11y/widget', about: @page, horizontal: true, small: true %> - <hr class="my-5"> - <%= render 'admin/communication/websites/pages/show/details' %> + <%= osuny_separator %> + <div class="row"> + <div class="col-lg-4"> + <%= render 'admin/communication/websites/pages/show/metadata' %> + <%= render 'admin/application/i18n/widget', about: @page, small: true %> + </div> + <div class="col-lg-8"> + <%= render 'admin/application/summary/show', about: @page, small: true %> + <%= render 'admin/application/meta_description/show', about: @page, small: true %> + </div> + </div> <%= render 'admin/communication/blocks/content/editor', about: @page %> <% end %> diff --git a/app/views/admin/communication/websites/pages/show/_details.html.erb b/app/views/admin/communication/websites/pages/show/_details.html.erb deleted file mode 100644 index 09edb92499b90b965f2664a5d25a504caa6d6c5e..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/websites/pages/show/_details.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<div class="row"> - <div class="col-lg-4"> - <%= render 'admin/communication/websites/pages/show/metadata' %> - <%= render 'admin/application/i18n/widget', about: @page, small: true %> - </div> - <div class="col-lg-8"> - <%= render 'admin/application/summary/show', about: @page, small: true %> - <%= render 'admin/application/meta_description/show', about: @page, small: true %> - </div> -</div> diff --git a/app/views/admin/communication/websites/pages/show/_heading.html.erb b/app/views/admin/communication/websites/pages/show/_heading.html.erb deleted file mode 100644 index 8f8c7f9ef134e0ce217ff3788ac19b336101527c..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/websites/pages/show/_heading.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<div class="row"> - <div class="col-lg-7"> - <%= osuny_panel Communication::Website::Page.human_attribute_name(:title), small: true do %> - <p class="lead"><%= @page.title %></p> - <% end %> - </div> - <div class="offset-lg-1 col-lg-4"> - <%= render 'admin/application/featured_image/show', about: @page, small: true %> - </div> -</div> diff --git a/app/views/admin/communication/websites/pages/show/_metadata.html.erb b/app/views/admin/communication/websites/pages/show/_metadata.html.erb index 625fd8c86bbbe50279eec6aa298dd10044afe091..d5f2b1bd23dfa50eff925d9a82f0c714eafb6f35 100644 --- a/app/views/admin/communication/websites/pages/show/_metadata.html.erb +++ b/app/views/admin/communication/websites/pages/show/_metadata.html.erb @@ -1,6 +1,8 @@ +<% +# TODO i18n quand les phrases sont vraiment claires +# @pa t'affole pas, c'est pas encore le cas +%> <%= osuny_panel t('metadata'), small: true do %> - <% # TODO i18n quand c'est stable %> - <% if @page.is_special_page? %> <% page_type = t("communication.website.pages.defaults.#{@page.type_key}.title") %> <% if page_type != @page.to_s %> diff --git a/app/views/admin/communication/websites/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb index de94cacd6ee49229ccd3c8db77c9bc7479bcca22..1b25802e65ec1132075f21ffb1ce9a9722d7289c 100644 --- a/app/views/admin/communication/websites/posts/show.html.erb +++ b/app/views/admin/communication/websites/posts/show.html.erb @@ -3,12 +3,12 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="row"> <div class="col-lg-7"> - <%= osuny_panel Communication::Website::Post.human_attribute_name(:title) do %> + <%= osuny_panel Communication::Website::Post.human_attribute_name(:title), small: true do %> <p class="lead"><%= @post.title %></p> <% end %> </div> <div class="offset-lg-1 col-lg-4"> - <%= render 'admin/application/featured_image/show', about: @post %> + <%= render 'admin/application/featured_image/show', about: @post, small: true %> </div> </div> <hr class="mb-5"> @@ -20,7 +20,7 @@ <%= render 'admin/application/i18n/widget', about: @post, small: true %> </div> <div class="col-lg-8"> - <%= render 'admin/application/summary/show', about: @post %> + <%= render 'admin/application/summary/show', about: @post, small: true %> <%= render 'admin/application/meta_description/show', about: @post %> </div> </div> diff --git a/app/views/admin/communication/websites/posts/show/_metadata.html.erb b/app/views/admin/communication/websites/posts/show/_metadata.html.erb index 00644de833f89be604bd9c4e0fa3d550f5b78f07..66d79126d2c7d3907b8d7f2e57b7ddedb243585f 100644 --- a/app/views/admin/communication/websites/posts/show/_metadata.html.erb +++ b/app/views/admin/communication/websites/posts/show/_metadata.html.erb @@ -1,3 +1,7 @@ +<% +# TODO i18n quand les phrases sont vraiment claires +# @pa t'affole pas, c'est pas encore le cas +%> <div class="mb-4"> <%= osuny_label t('metadata') %><br> <% if @post.published %> diff --git a/app/views/admin/education/academic_years/show.html.erb b/app/views/admin/education/academic_years/show.html.erb index a6410b0ffd811dcdabdf612b997c6d33b0d78da8..e9af10dc67f76cbc6c1b3f47c43719b46470e676 100644 --- a/app/views/admin/education/academic_years/show.html.erb +++ b/app/views/admin/education/academic_years/show.html.erb @@ -6,6 +6,6 @@ <% end %> <% if @academic_year.people.any? %> - <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> + <h2 class="mt-5"><%= 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 dff68265f6e01ff274adb4a8128ff2e579ef473c..f2ce7c1d9d6ce1fa25ffe648ec01fca6a100b703 100644 --- a/app/views/admin/education/cohorts/show.html.erb +++ b/app/views/admin/education/cohorts/show.html.erb @@ -1,21 +1,21 @@ <% content_for :title, @cohort %> <div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-body"> - <%= osuny_label Education::Cohort.human_attribute_name('school') %> - <p><%= link_to_if can?(:read, @cohort.school), @cohort.school, [:admin, @cohort.school] %></p> - <%= osuny_label Education::Cohort.human_attribute_name('program') %> - <p><%= link_to_if can?(:read, @cohort.program), @cohort.program, [:admin, @cohort.program] %></p> - <%= osuny_label Education::Cohort.human_attribute_name('year') %> - <p><%= link_to_if can?(:read, @cohort.academic_year), @cohort.academic_year, [:admin, @cohort.academic_year] %></p> - </div> - </div> + <div class="col-lg-4"> + <%= osuny_label Education::Cohort.human_attribute_name('school') %> + <p><%= link_to_if can?(:read, @cohort.school), @cohort.school, [:admin, @cohort.school] %></p> + </div> + <div class="col-lg-4"> + <%= osuny_label Education::Cohort.human_attribute_name('program') %> + <p><%= link_to_if can?(:read, @cohort.program), @cohort.program, [:admin, @cohort.program] %></p> + </div> + <div class="col-lg-4"> + <%= osuny_label Education::Cohort.human_attribute_name('year') %> + <p><%= link_to_if can?(:read, @cohort.academic_year), @cohort.academic_year, [:admin, @cohort.academic_year] %></p> </div> </div> <% if @cohort.people.any? %> - <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> + <h2 class="mt-5"><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> <%= render 'admin/university/alumni/list', alumni: @cohort.people.ordered %> <% end %> diff --git a/app/views/admin/education/programs/preview.html.erb b/app/views/admin/education/programs/preview.html.erb index 04c570b97750d133fae148d6ed462c97cdf50006..6d7ec4dd69cf7669943be28bc7366e07b8dbc797 100644 --- a/app/views/admin/education/programs/preview.html.erb +++ b/app/views/admin/education/programs/preview.html.erb @@ -28,15 +28,15 @@ </tr> <% end %> <tr> - <th>Formation initiale</th> + <th><%= Education::Program.human_attribute_name('initial') %></th> <td><%= t @program.initial %></td> </tr> <tr> - <th>Formation continue</th> + <th><%= Education::Program.human_attribute_name('continuing') %></th> <td><%= t @program.continuing %></td> </tr> <tr> - <th>Apprentissage</th> + <th><%= Education::Program.human_attribute_name('apprenticeship') %></th> <td><%= t @program.apprenticeship %></td> </tr> </tbody> diff --git a/app/views/admin/education/programs/roles/_form.html.erb b/app/views/admin/education/programs/roles/_form.html.erb index 08cfb054eff66f7b189b4593cfb47bf2c86200a9..583289a20ad86d220638319b51d59a4857a8b046 100644 --- a/app/views/admin/education/programs/roles/_form.html.erb +++ b/app/views/admin/education/programs/roles/_form.html.erb @@ -5,33 +5,20 @@ <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <div class="row"> - <div class="col-md-8"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('admin.infos') %></h5> - </div> - <div class="card-body"> - <%= f.input :description, as: :string %> - </div> - </div> + <div class="col-lg-6"> + <%= f.input :description, as: :string %> </div> - <div class="col-md-4"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= University::Person.model_name.human(count: 2) %></h5> - </div> - <div class="card-body"> - <%= link_to_add_association t('add'), f, :involvements, class: "btn btn-primary mb-3", data: { - 'association-insertion-method': 'append', - 'association-insertion-node': '#involvements' - } %> + <div class="col-lg-6"> + <%= osuny_label University::Person.model_name.human(count: 2) %><br> + <%= link_to_add_association t('add'), f, :involvements, class: button_classes, data: { + 'association-insertion-method': 'append', + 'association-insertion-node': '#involvements' + } %> - <div class="mb-3" id="involvements" data-sortable="inputs"> - <%= f.simple_fields_for :involvements, role.involvements.sort_by(&:position), include_id: false do |involvement_f| %> - <%= render 'admin/education/programs/roles/involvement_fields', f: involvement_f, include_id: true %> - <% end %> - </div> - </div> + <div class="mt-3" id="involvements" data-sortable="inputs"> + <%= f.simple_fields_for :involvements, role.involvements.sort_by(&:position), include_id: false do |involvement_f| %> + <%= render 'admin/education/programs/roles/involvement_fields', f: involvement_f, include_id: true %> + <% end %> </div> </div> </div> diff --git a/app/views/admin/education/programs/roles/_involvement_fields.html.erb b/app/views/admin/education/programs/roles/_involvement_fields.html.erb index cb51049ffb7ec1b79333563f0ff8ef16346c13b6..73aeb65456d1e4bb5544cc9d2394709367bc4477 100644 --- a/app/views/admin/education/programs/roles/_involvement_fields.html.erb +++ b/app/views/admin/education/programs/roles/_involvement_fields.html.erb @@ -1,24 +1,16 @@ <% include_id ||= false %> -<div class="card nested-fields mb-2"> - <div class="card-body"> - <div class="row align-items-center"> - <div class="col-1"> - <i class="<%= Icon::DRAG %> handle"></i> - </div> - <div class="col-9"> - <%= f.association :person, - collection: @administration_people, - label: false, - include_blank: :translate, - wrapper: false, - required: true %> - </div> - <div class="col-2"> - <%= link_to_remove_association "<i class=\"#{ Icon::DELETE }\"></i>".html_safe, - f, - class: 'btn btn-sm btn-danger' %> - </div> - </div> +<div class="nested-fields mb-2"> + <div class="d-flex align-items-center"> + <i class="<%= Icon::DRAG %> handle"></i> + <%= f.association :person, + collection: @administration_people, + label: false, + include_blank: :translate, + wrapper: false, + required: true %> + <%= link_to_remove_association "<i class=\"#{ Icon::DELETE }\"></i>".html_safe, + f, + class: 'btn btn-sm text-danger' %> </div> <%= f.hidden_field :position, data: { 'sortable-input': '' } %> <%= f.hidden_field :id if include_id %> diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 6d32843fc32894991cbcf746e6396f400b18fb27..4e8d905143b91ceafdef259745635250bc58cf2c 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -1,124 +1,127 @@ <% content_for :title, @program %> <div class="row"> - <div class="col-lg-8 col-xxl-9"> - <%= render 'admin/application/summary/show', about: @program %> - <%= render 'admin/education/programs/forms/part', - part: :essential, - collapsed: false do %> - <div class="row"> - <div class="col-lg-6"> - <%= osuny_label Education::Program.human_attribute_name('name') %> - <p><%= @program.name %></p> - <%= osuny_label Education::Program.human_attribute_name('diploma') %> - <p><%= link_to @program.diploma, [:admin, @program.diploma] if @program.diploma %></p> - <% if @program.schools.any? %> - <%= osuny_label Education::Program.human_attribute_name('schools') %> - <ul class="list-unstyled"> - <% @program.schools.ordered.each do |school| %> - <li><%= link_to_if can?(:read, school), school, [:admin, school] %></li> - <% end %> - </ul> - <% end %> - </div> - <div class="col-lg-6"> - <%= osuny_label Education::Program.human_attribute_name('short_name') %> - <p><%= @program.short_name %></p> - <%= osuny_label Education::Program.human_attribute_name('capacity') %> - <p><%= @program.capacity %></p> - <%= osuny_label Education::Program.human_attribute_name('initial') %> - <p><%= t @program.initial %></p> - <%= osuny_label Education::Program.human_attribute_name('continuing') %> - <p><%= t @program.continuing %></p> - <%= osuny_label Education::Program.human_attribute_name('apprenticeship') %> - <p><%= t @program.apprenticeship %></p> - <% if @program.downloadable_summary.attached? %> - <%= osuny_label Education::Program.human_attribute_name('downloadable_summary') %> - <p><%= link_to "#{@program.downloadable_summary.filename} (#{ number_to_human_size @program.downloadable_summary.blob.byte_size })", - url_for(@program.downloadable_summary), - target: :_blank %></p> - <% end %> - </div> - </div> - <% end %> - <%= render 'admin/education/programs/forms/part', part: :presentation, collapsed: true do %> - <div class="row"> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :presentation %> - </div> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :objectives %> - </div> - </div> - <% end %> - <%= render 'admin/communication/blocks/content/editor', about: @program %> - <hr class="pure__separation"> - <%= render 'admin/education/programs/forms/part', part: :pedagogy, collapsed: true do %> - <div class="row"> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :content %> - </div> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :pedagogy %> - <%= render 'admin/application/property/text', object: @program, property: :evaluation %> - </div> - </div> - <%= render 'admin/education/programs/show/teachers', involvements: @teacher_involvements %> - <% end %> - <%= render 'admin/education/programs/forms/part', part: :results, collapsed: true do %> - <div class="row"> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :opportunities %> - </div> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :results %> - </div> - </div> - <% end %> - <%= render 'admin/education/programs/forms/part', part: :admission, collapsed: true do %> - <div class="row"> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :prerequisites %> - <%= render 'admin/application/property/text', object: @program, property: :registration %> - <%= render 'admin/application/property/text', object: @program, property: :other %> - </div> - <div class="col-xxl-6"> - <%= render 'admin/application/property/text', object: @program, property: :pricing %> - <%= render 'admin/application/property/text', object: @program, property: :accessibility %> - <%= render 'admin/application/property/text', object: @program, property: :contacts %> - <% if @program.registration_url.present? %> - <%= osuny_label Education::Program.human_attribute_name(:registration_url) %> - <p><%= link_to @program.registration_url, @program.registration_url, target: :_blank %></p> - <% end %> - </div> - </div> - <%= render 'admin/education/programs/show/roles', roles: @roles %> + <div class="col-lg-8"> + <%= osuny_panel Education::Program.human_attribute_name('name'), small: true do %> + <p class="lead"><%= @program.name %></p> <% end %> + </div> + <div class="offset-lg-1 col-lg-3"> + <%= render 'admin/application/featured_image/show', about: @program, small: true %> + </div> +</div> - <% if @program.children.any? %> - <%= osuny_panel Education::Program.model_name.human(count: 2) do %> - <%= render 'admin/education/programs/list', programs: @program.children %> - <% end %> - <% end %> +<%= osuny_separator %> +<%= render 'admin/education/programs/show/details', program: @program %> + +<%= osuny_separator %> +<%= render 'admin/application/a11y/widget', about: @program, horizontal: true, small: true %> + +<%= osuny_separator %> +<div class="row mb-5"> + <div class="col-lg-4"> + <%= render 'admin/education/programs/show/metadata', program: @program %> + </div> + <div class="col-lg-8"> + <%= render 'admin/application/summary/show', about: @program, small: true %> + </div> +</div> + +<div class="row"> + <div class="col-lg-4"> + <h2 class="h4"><%= t("education.program.parts.presentation.label") %></h2> + </div> +</div> +<div class="row"> + <div class="offset-lg-4 col-lg-8"> + <%= render 'admin/application/property/text', object: @program, property: :presentation %> + <%= render 'admin/application/property/text', object: @program, property: :objectives %> + <%= osuny_label 'Informations administratives' %> + <table class="table"> + <tbody> + <tr> + <th><%= Education::Program.human_attribute_name('initial') %></th> + <td class="text-end"><%= t @program.initial %></td> + </tr> + <tr> + <th><%= Education::Program.human_attribute_name('continuing') %></th> + <td class="text-end"><%= t @program.continuing %></td> + </tr> + <tr> + <th><%= Education::Program.human_attribute_name('apprenticeship') %></th> + <td class="text-end"><%= t @program.apprenticeship %></td> + </tr> + <tr> + <th><%= Education::Program.human_attribute_name('capacity') %></th> + <td class="text-end"><%= @program.capacity %></td> + </tr> + </tbody> + </table> + </div> +</div> + +<%= render 'admin/communication/blocks/content/editor', about: @program %> - <%= render 'admin/education/programs/show/cohorts' %> +<div class="row"> + <div class="col-lg-4"> + <h2 class="h4"><%= t("education.program.parts.pedagogy.label") %></h2> + </div> +</div> +<div class="row"> + <div class="offset-lg-4 col-lg-8"> + <%= render 'admin/application/property/text', object: @program, property: :content %> + <%= render 'admin/application/property/text', object: @program, property: :pedagogy %> + <%= render 'admin/application/property/text', object: @program, property: :evaluation %> + <%= render 'admin/education/programs/show/teachers', involvements: @teacher_involvements %> + </div> +</div> + +<div class="row"> + <div class="col-lg-4"> + <h2 class="h4"><%= t("education.program.parts.results.label") %></h2> + </div> +</div> +<div class="row"> + <div class="offset-lg-4 col-lg-8"> + <%= render 'admin/application/property/text', object: @program, property: :opportunities %> + <%= render 'admin/application/property/text', object: @program, property: :results %> </div> - <div class="col-lg-4 col-xxl-3"> - <%= render 'admin/education/programs/forms/part', part: :technical do %> - <%= osuny_label Education::Program.human_attribute_name('published') %> - <p><%= t @program.published %></p> - <%= osuny_label Education::Program.human_attribute_name('slug') %> - <p><%= @program.slug %></p> - <% if @program.parent %> - <%= osuny_label Education::Program.human_attribute_name('parent') %> - <p><%= link_to @program.parent, [:admin, @program.parent] %></p> - <% end %> +</div> + +<div class="row"> + <div class="col-lg-4"> + <h2 class="h4"><%= t("education.program.parts.admission.label") %></h2> + </div> +</div> +<div class="row"> + <div class="offset-lg-4 col-lg-8"> + <%= render 'admin/application/property/text', object: @program, property: :prerequisites %> + <%= render 'admin/application/property/text', object: @program, property: :registration %> + <%= render 'admin/application/property/text', object: @program, property: :other %> + <%= render 'admin/application/property/text', object: @program, property: :pricing %> + <%= render 'admin/application/property/text', object: @program, property: :accessibility %> + <%= render 'admin/application/property/text', object: @program, property: :contacts %> + <% if @program.registration_url.present? %> + <%= osuny_label Education::Program.human_attribute_name(:registration_url) %> + <p><%= link_to @program.registration_url, @program.registration_url, target: :_blank %></p> <% end %> - <%= render 'admin/application/featured_image/show', about: @program %> - <%= render 'admin/application/meta_description/show', about: @program %> + <%= render 'admin/education/programs/show/roles', roles: @roles %> </div> </div> +<% if @program.cohorts.any? %> + <div class="row"> + <div class="col-lg-4"> + <h2 class="h4"><%= Education::Cohort.model_name.human(count: 2) %></h2> + </div> + </div> + <div class="row"> + <div class="offset-lg-4 col-lg-8"> + <%= render 'admin/education/programs/show/cohorts' %> + </div> + </div> +<% end %> + <% content_for :action_bar_left do %> <%= destroy_link @program %> <%= static_link static_admin_education_program_path(@program) %> diff --git a/app/views/admin/education/programs/show/_cohorts.html.erb b/app/views/admin/education/programs/show/_cohorts.html.erb index 7fe9783c8289984fe9bc3f7778df181c513183b8..2832f12410bdef987f9338dbb7b6a4a4f549e6ab 100644 --- a/app/views/admin/education/programs/show/_cohorts.html.erb +++ b/app/views/admin/education/programs/show/_cohorts.html.erb @@ -1,30 +1,25 @@ -<% if @program.cohorts.any? %> - <%= osuny_panel Education::Cohort.model_name.human(count: 2), - subtitle: "#{@program.alumni.count} #{University::Person::Alumnus.model_name.human(count: @program.alumni.count).downcase}" do %> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <th><%= Education::Cohort.human_attribute_name('year') %></th> - <th><%= Education::Cohort.human_attribute_name('school') %></th> - <th><%= Education::Cohort.human_attribute_name('alumni') %></th> - </tr> - </thead> - <tbody> - <% @program.cohorts.ordered.each do |cohort| %> - <tr> - <td> - <%= link_to [:admin, cohort] do %> - <%= cohort.academic_year %> - <%= cohort.name %> - <% end %> - </td> - <td><%= link_to_if can?(:read, cohort.school), cohort.school, [:admin, cohort.school] %></td> - <td><%= cohort.people.count %></td> - </tr> - <% end %> - </tbody> - </table> - </div> - <% end %> -<% end %> +<div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> + <tr> + <th><%= Education::Cohort.human_attribute_name('year') %></th> + <th><%= Education::Cohort.human_attribute_name('school') %></th> + <th><%= Education::Cohort.human_attribute_name('alumni') %></th> + </tr> + </thead> + <tbody> + <% @program.cohorts.ordered.each do |cohort| %> + <tr> + <td> + <%= link_to [:admin, cohort] do %> + <%= cohort.academic_year %> + <%= cohort.name %> + <% end %> + </td> + <td><%= link_to_if can?(:read, cohort.school), cohort.school, [:admin, cohort.school] %></td> + <td><%= cohort.people.count %></td> + </tr> + <% end %> + </tbody> + </table> +</div> \ No newline at end of file diff --git a/app/views/admin/education/programs/show/_details.html.erb b/app/views/admin/education/programs/show/_details.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..94cdb6871b325ee024fd8ceaf57e9aed9ce6d31c --- /dev/null +++ b/app/views/admin/education/programs/show/_details.html.erb @@ -0,0 +1,36 @@ +<div class="row"> + <div class="col-lg-4"> + <%= osuny_label Education::Program.human_attribute_name('diploma') %> + <p><%= link_to program.diploma, [:admin, program.diploma] if program.diploma %></p> + <% if program.schools.any? %> + <%= osuny_label Education::Program.human_attribute_name('schools') %> + <ul class="list-unstyled"> + <% program.schools.ordered.each do |school| %> + <li><%= link_to_if can?(:read, school), school, [:admin, school] %></li> + <% end %> + </ul> + <% end %> + </div> + <div class="col-lg-8"> + <%= osuny_label Education::Program.human_attribute_name('short_name') %> + <p><%= program.short_name %></p> + <% if program.downloadable_summary.attached? %> + <%= osuny_label Education::Program.human_attribute_name('downloadable_summary') %> + <p><%= link_to "#{program.downloadable_summary.filename} (#{ number_to_human_size program.downloadable_summary.blob.byte_size })", + url_for(program.downloadable_summary), + target: :_blank %></p> + <% end %> + <% if @program.parent %> + <%= osuny_label Education::Program.human_attribute_name('parent') %> + <p><%= link_to @program.parent, [:admin, @program.parent] %></p> + <% end %> + <% if @program.children.any? %> + <%= osuny_label Education::Program.model_name.human(count: 2) %> + <ul class="list-unstyled"> + <% @program.children.each do |child| %> + <li><%= link_to child, [:admin, child] %></li> + <% end %> + </ul> + <% end %> + </div> +</div> \ No newline at end of file diff --git a/app/views/admin/education/programs/show/_metadata.html.erb b/app/views/admin/education/programs/show/_metadata.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c5930814e4de83332627243b08b38e88c5dab9e8 --- /dev/null +++ b/app/views/admin/education/programs/show/_metadata.html.erb @@ -0,0 +1,6 @@ +<%= osuny_label t('metadata') %> +<p> + <%= @program.published ? 'Publiée' : 'Brouillon' %> +</p> + +<%= render 'admin/application/property/text', object: @program, property: :meta_description %> diff --git a/app/views/admin/education/programs/show/_roles.html.erb b/app/views/admin/education/programs/show/_roles.html.erb index e8e362c4185f6cb04eebdf286d4f231f4a24452b..36cfdc5100c7b4a919c932d7b597b071b033c829 100644 --- a/app/views/admin/education/programs/show/_roles.html.erb +++ b/app/views/admin/education/programs/show/_roles.html.erb @@ -1,32 +1,34 @@ -<div class="float-end pt-4"> - <% if !current_user.program_manager? || current_user.programs_to_manage.pluck(:education_program_id).include?(@program.id) %> - <%= link_to t('education.manage_roles'), - admin_education_program_roles_path(program_id: @program.id), - class: button_classes if can?(:update, University::Role) %> - <% end %> -</div> -<h4 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('roles') %></h4> -<% if @roles.any? %> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <th class="ps-0"><%= University::Role.model_name.human %></th> - <th><%= University::Role.human_attribute_name('people') %></th> - </tr> - </thead> - <tbody> - <% @roles.each do |role| %> +<% +action = '' +if !current_user.program_manager? || current_user.programs_to_manage.pluck(:education_program_id).include?(@program.id) +action += link_to t('education.manage_roles'), + admin_education_program_roles_path(program_id: @program.id), + class: button_classes if can?(:update, University::Role) +end +%> +<%= osuny_panel Education::Program.human_attribute_name('roles'), action: action, classes: 'mt-5' do %> + <% if @roles.any? %> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> <tr> - <td class="ps-0"> - <%= link_to_if can?(:update, role), - role, - edit_admin_education_program_role_path(role, { program_id: @program.id }) %> - </td> - <td><%= role.involvements.includes(:person).ordered.map { |involvement| link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) }.to_sentence.html_safe %></td> + <th class="ps-0"><%= University::Role.model_name.human %></th> + <th><%= University::Role.human_attribute_name('people') %></th> </tr> - <% end %> - </tbody> - </table> -</div> -<% end %> + </thead> + <tbody> + <% @roles.each do |role| %> + <tr> + <td class="ps-0"> + <%= link_to_if can?(:update, role), + role, + edit_admin_education_program_role_path(role, { program_id: @program.id }) %> + </td> + <td><%= role.involvements.includes(:person).ordered.map { |involvement| link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) }.to_sentence.html_safe %></td> + </tr> + <% end %> + </tbody> + </table> + </div> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/education/programs/show/_teachers.html.erb b/app/views/admin/education/programs/show/_teachers.html.erb index 3ead05e8ff9bab85cf6d61f161530167a59db34c..59818b68cab6b2eb939ae8a56887754a9095824a 100644 --- a/app/views/admin/education/programs/show/_teachers.html.erb +++ b/app/views/admin/education/programs/show/_teachers.html.erb @@ -1,30 +1,32 @@ -<div class="float-end pt-4"> - <% if !current_user.program_manager? || current_user.programs_to_manage.pluck(:education_program_id).include?(@program.id) %> - <%= link_to t('education.manage_teachers'), - admin_education_program_teachers_path(program_id: @program.id), - class: button_classes if can?(:update, University::Person::Involvement) %> - <% end %> -</div> -<h4 class="h5 mt-4 mb-3"><%= Education::Program.human_attribute_name('teachers') %></h4> -<% if @teacher_involvements.any? %> - <div class="table-responsive"> - <table class="<%= table_classes %>"> - <thead> - <tr> - <th class="ps-0"><%= University::Person.model_name.human %></th> - <th><%= University::Person::Involvement.human_attribute_name('description') %></th> - </tr> - </thead> - <tbody> - <% @teacher_involvements.each do |involvement| %> +<% +action = '' +if !current_user.program_manager? || current_user.programs_to_manage.pluck(:education_program_id).include?(@program.id) +action += link_to t('education.manage_teachers'), + admin_education_program_teachers_path(program_id: @program.id), + class: button_classes if can?(:update, University::Person::Involvement) +end +%> +<%= osuny_panel Education::Program.human_attribute_name('teachers'), action: action, classes: 'mt-5' do %> + <% if @teacher_involvements.any? %> + <div class="table-responsive"> + <table class="<%= table_classes %>"> + <thead> <tr> - <td class="ps-0"> - <%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %> - </td> - <td><%= involvement.description %></td> + <th class="ps-0"><%= University::Person.model_name.human %></th> + <th><%= University::Person::Involvement.human_attribute_name('description') %></th> </tr> - <% end %> - </tbody> - </table> -</div> -<% end %> + </thead> + <tbody> + <% @teacher_involvements.each do |involvement| %> + <tr> + <td class="ps-0"> + <%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %> + </td> + <td><%= involvement.description %></td> + </tr> + <% end %> + </tbody> + </table> + </div> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/education/programs/teachers/_form.html.erb b/app/views/admin/education/programs/teachers/_form.html.erb index c1c2a892d4f39c4abf199ad1e89059b248eae4a6..61c000a4ddd7e9bf095f7e90f88c320d7b6544c4 100644 --- a/app/views/admin/education/programs/teachers/_form.html.erb +++ b/app/views/admin/education/programs/teachers/_form.html.erb @@ -3,20 +3,12 @@ : admin_education_program_teacher_path(involvement, { program_id: @program.id }) do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> - - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('admin.infos') %></h5> + <div class="row"> + <div class="col-lg-6"> + <%= f.association :person, collection: @available_people %> </div> - <div class="card-body"> - <div class="row"> - <div class="col-md-6"> - <%= f.association :person, collection: @available_people %> - </div> - <div class="col-md-6"> - <%= f.input :description, as: :string %> - </div> - </div> + <div class="col-lg-6"> + <%= f.input :description, as: :string %> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/layouts/themes/pure/_panel.html.erb b/app/views/admin/layouts/themes/pure/_panel.html.erb index b622082ac797edb270d579020b4839b6e776e8c4..bb0a22399159b674701ce676ef4caa4c94a6fef9 100644 --- a/app/views/admin/layouts/themes/pure/_panel.html.erb +++ b/app/views/admin/layouts/themes/pure/_panel.html.erb @@ -1,4 +1,4 @@ -<section class="pure__section flex-fill position-relative"> +<section class="pure__section flex-fill position-relative <%= classes %>"> <%= image_tag image, class: 'img-fluid mb-3', loading: :lazy if image %> <div class="d-flex"> <% if title %>