noesya/osuny

View on GitHub
app/views/admin/education/programs/static.html.erb

Summary

Maintainability
Test Coverage
<%
program = @l10n.about
language = @l10n.language
teacher_involvements = program.university_person_involvements
                              .includes(:person)
                              .ordered_by_name(language)
administrator_involvements = program.involvements_through_roles
                                   .includes(:person)
                                   .ordered_by_name(language)
%>---
<%= render 'admin/application/static/core', about: @l10n, skip_date: true %>
<%= render 'admin/application/static/breadcrumbs', about: @l10n %>
<%= render 'admin/application/static/design',
            about: program,
            full_width: false,
            toc_offcanvas: true,
            toc_present: true %>
<%= render 'admin/application/categories/static',
            about: program,
            l10n: @l10n,
            categories: program.university.program_categories,
            key: :programs_categories %>

<% if @l10n.downloadable_summary.attached? %>
downloadable_summary: <%= @l10n.downloadable_summary.blob_id %>
<% end %>
bodyclass: <%= program.bodyclass %>
website_url: >-
  <%= @l10n.url %>
registration_url: >-
  <%= @l10n.registration_url %>
<%= render 'admin/application/meta_description/static', about: @l10n %>
<%= render 'admin/application/summary/static', about: @l10n %>
position: <%= program.position %>
<% if @l10n.parent %>
parent:
  title: >-
    <%= @l10n.parent.name %>
  url: <%= @l10n.parent.current_permalink_in_website(@website)&.path %>
<% end %>
<%= render 'admin/application/l10n/static', about: @l10n %>
<%= render 'admin/application/featured_image/static', about: @l10n %>
<%= render 'admin/application/shared_image/static', about: @l10n %>
<% if @l10n.logo.attached? %>
logo:
  id: "<%= @l10n.logo.blob.id %>"
<% end %>
<%
if @website
  website_category_l10ns = program.website_category_l10ns_for(@website, language)
  if website_category_l10ns[:blog]
%>
<%# related_category is deprecated, in favor of related_categories %>
related_category: "<%= website_category_l10ns[:blog].slug_with_ancestors_slugs(separator: '-') %>"
<%
  end
%>
related_categories:
<% website_category_l10ns.each do |key, website_category_l10n| %>
  <%= key %>: "<%= website_category_l10n.slug_with_ancestors_slugs(separator: '-') %>"
<%
  end
end
%>
diplomas: "<%= @l10n.diploma&.slug %>"
duration: >-
  <%= prepare_text_for_static @l10n.duration %>
teachers:
<%
teacher_involvements.each do |involvement|
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  - "<%= person_l10n.slug %>"
<% end %>
teachers_description:
<%
teacher_involvements.each do |involvement|
  involvement_l10n = involvement.localization_for(language)
  next if involvement_l10n.nil?
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  "<%= person_l10n.slug %>": >-
    <%= involvement_l10n.description %>
<% end %>
<% if administrator_involvements.any? %>
administrators:
<%
administrator_involvements.each do |involvement|
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  - "<%= person_l10n.slug %>"
<% end %>
administrators_description:
<%
administrator_involvements.each do |involvement|
  person_l10n = involvement.person.localization_for(language)
  next if person_l10n.nil?
%>
  "<%= person_l10n.slug %>": >-
    <%= involvement.target.to_s_in(language) %>
<% end %>
roles:
<% program.university_roles.ordered.each do |role| %>
  - title: >-
      <%= role.to_s_in(language) %>
    persons:
    <%
    role.involvements.ordered.each do |involvement|
      person_l10n = involvement.person.localization_for(language)
      next if person_l10n.nil?
    %>
      - "<%= person_l10n.slug %>"
    <% end %>
<% end %>
<% else %>
roles: []
<% end %>
locations:
<% program.locations.each do |location| %>
  <%
  location_l10n = location.localization_for(language)
  next if location_l10n.nil?
  %>
  - path: <%= location_l10n.current_permalink_in_website(@website)&.path %>
    slug: <%= location_l10n.slug %>
<% end %>
apprenticeship: <%= program.apprenticeship %>
capacity: <%= program.capacity %>
continuing: <%= program.continuing %>
initial: <%= program.initial %>
certifications:
  qualiopi:
    certified: <%= program.qualiopi_certified %>
    text: >-
      <%= prepare_html_for_static @l10n.qualiopi_text %>
presentation: >-
  <%= prepare_html_for_static @l10n.presentation %>
<%
[
  :accessibility,
  :contacts,
  :content,
  :evaluation,
  :objectives,
  :opportunities,
  :other,
  :pedagogy,
  :prerequisites,
  :pricing,
  :pricing_initial,
  :pricing_continuing,
  :pricing_apprenticeship,
  :registration,
  :results
].each do |property| %>
<%= property.to_s %>: >-
  <%= prepare_html_for_static @l10n.send("best_#{property}") %>
<% end %>
<%= render 'admin/communication/contents/static', about: @l10n %>
---