From afc817758aa1bf1de4366e412b71fa7424b22cbf Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 08:46:23 +0100 Subject: [PATCH 01/14] wip --- app/helpers/admin/application_helper.rb | 22 ------------ app/helpers/admin/osuny_static_helper.rb | 30 ++++++++++++++++ .../people/administrators/static.html.erb | 9 ++--- .../admin/university/people/static.html.erb | 35 +++++++++---------- 4 files changed, 49 insertions(+), 47 deletions(-) create mode 100644 app/helpers/admin/osuny_static_helper.rb diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index 11929ff6b1..bf1165a9d0 100644 --- a/app/helpers/admin/application_helper.rb +++ b/app/helpers/admin/application_helper.rb @@ -93,22 +93,6 @@ def submit(form, **options) **options end - def prepare_html_for_static(text) - university = current_university || @website&.university || @about&.university - html = Static::Html.new(text, about: @about, university: university).prepared - # Les notes vont de 1 à n sur la page, il faut donc que l'index soit pour toute la page (tout le fichier static). - # C'est pour cela qu'on passe par le helper, ce qui garde @index. - prepare_notes html - end - - def prepare_text_for_static(text, depth: 1) - Static::Text.new(text, depth: depth, about: @about).prepared - end - - def prepare_code_for_static(text, depth: 1) - Static::Code.new(text, depth: depth, about: @about).prepared - end - def has_content?(html) strip_tags(html.to_s).present? end @@ -125,12 +109,6 @@ def indent(text, depth) text end - def prepare_media_for_static(object, key) - media = object[key]['id'] - rescue - '' - end - def collection(list) list.ordered.map do |e| { diff --git a/app/helpers/admin/osuny_static_helper.rb b/app/helpers/admin/osuny_static_helper.rb new file mode 100644 index 0000000000..06a0940540 --- /dev/null +++ b/app/helpers/admin/osuny_static_helper.rb @@ -0,0 +1,30 @@ +module Admin::OsunyStaticHelper + + def prepare_html_for_static(text) + university = current_university || @website&.university || @about&.university + html = Static::Html.new(text, about: @about, university: university).prepared + # Les notes vont de 1 à n sur la page, il faut donc que l'index soit pour toute la page (tout le fichier static). + # C'est pour cela qu'on passe par le helper, ce qui garde @index. + prepare_notes html + end + + def prepare_text_for_static(text, depth: 1) + Static::Text.new(text, depth: depth, about: @about).prepared + end + + def prepare_code_for_static(text, depth: 1) + Static::Code.new(text, depth: depth, about: @about).prepared + end + + def prepare_media_for_static(object, key) + media = object[key]['id'] + rescue + '' + end + + def osuny_static_string(key, value, depth: 1) + return if value.blank? + raw "#{key}: >-\n #{prepare_text_for_static(value, depth: depth)}" + end + +end \ No newline at end of file diff --git a/app/views/admin/university/people/administrators/static.html.erb b/app/views/admin/university/people/administrators/static.html.erb index 1b53fb3396..5b92f9d854 100644 --- a/app/views/admin/university/people/administrators/static.html.erb +++ b/app/views/admin/university/people/administrators/static.html.erb @@ -13,12 +13,9 @@ breadcrumb_title = t('university.person.facets.administrator.responsabilities', l10n: @l10n, full_width: true, toc_offcanvas: true %> -person: >- - <%= person_l10n.to_s %> -first_name: >- - <%= person_l10n.first_name %> -last_name: >- - <%= person_l10n.last_name %> +<%= osuny_static_string 'person', person_l10n.to_s %> +<%= osuny_static_string 'first_name', person_l10n.first_name %> +<%= osuny_static_string 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/meta_description/static', about: person_l10n %> <%= render 'admin/application/summary/static', about: person_l10n %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index d6b48ce5f8..162ee3cf69 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -19,30 +19,27 @@ linkTitle: >- <%= render 'admin/application/meta_description/static', about: @l10n %> <%= render 'admin/application/summary/static', about: @l10n %> <%= render 'admin/application/l10n/static', about: @l10n %> -person: >- - <%= prepare_text_for_static @l10n.to_s %> -first_name: >- - <%= prepare_text_for_static @l10n.first_name %> -last_name: >- - <%= prepare_text_for_static @l10n.last_name %> +<%= osuny_static_string 'person', person_l10n.to_s %> +<%= osuny_static_string 'first_name', person_l10n.first_name %> +<%= osuny_static_string 'last_name', person_l10n.last_name %> +<% +# Peut-on supprimer les contact details à la racine ? +# phone, email, twitter, linkedin, website +# Ils devraient être déjà dans admin/application/contact_details/static +%> <% if person.phone_mobile_is_public? %> -phone: >- - <%= prepare_text_for_static person.phone_mobile %> +<%= osuny_static_string 'phone', person.phone_mobile %> <% end %> <% if person.email_is_public? %> -email: >- - <%= prepare_text_for_static person.email %> +<%= osuny_static_string 'email', person.email %> <% end %> <% if person.twitter_is_public? %> -twitter: >- - <%= prepare_text_for_static @l10n.twitter %> +<%= osuny_static_string 'twitter', person.twitter %> <% end %> <% if person.linkedin_is_public? %> -linkedin: >- - <%= prepare_text_for_static @l10n.linkedin %> +<%= osuny_static_string 'linkedin', person.linkedin %> <% end %> -website: >- - <%= prepare_text_for_static @l10n.url %> +<%= osuny_static_string 'website', @l10n.url %> <%= render 'admin/application/contact_details/static', about: person, l10n: @l10n, @@ -78,15 +75,15 @@ teachings: hugo = program_l10n.hugo(@website) next if hugo.file.blank? %> - - description: >- - <%= involvement_l10n.description %> - program: + - program: title: >- <%= program_l10n.to_s %> permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" file: "<%= hugo.file %>" + description: >- + <%= involvement_l10n.description %> <% end %> <% end %> <% if person.roles_as_administrator.any? %> From 8a06dde0fa94286dc3766cf9fa2c8bf61d8e5d56 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 10:24:12 +0100 Subject: [PATCH 02/14] wip --- app/helpers/admin/osuny_static_helper.rb | 6 ++++++ app/views/admin/university/organizations/static.html.erb | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/helpers/admin/osuny_static_helper.rb b/app/helpers/admin/osuny_static_helper.rb index 06a0940540..0e34d3cd29 100644 --- a/app/helpers/admin/osuny_static_helper.rb +++ b/app/helpers/admin/osuny_static_helper.rb @@ -27,4 +27,10 @@ def osuny_static_string(key, value, depth: 1) raw "#{key}: >-\n #{prepare_text_for_static(value, depth: depth)}" end + def osuny_static_html(key, value) + text = strip_tags(value.to_s) + return if text.blank? + raw "#{key}: >-\n #{prepare_html_for_static(value)}" + end + end \ No newline at end of file diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb index e7e41df6d5..42066b37c1 100644 --- a/app/views/admin/university/organizations/static.html.erb +++ b/app/views/admin/university/organizations/static.html.erb @@ -23,8 +23,7 @@ cache cache_key do <%= render 'admin/application/connections/backlinks', about: @l10n %> <%= render 'admin/application/static/attribute/text', about: @about, key: :long_name %> <%= render 'admin/application/static/attribute/text', about: organization, key: :siren %> -text: >- - <%= prepare_html_for_static @l10n.text %> +<%= osuny_static_html 'text', @l10n.text %> kind: code: "<%= organization.kind %>" label: "<%= organization.kind_i18n %>" From 42e83b3b126ce9841d2ce6784cd93882b8dadf4c Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 10:39:28 +0100 Subject: [PATCH 03/14] wip --- app/helpers/admin/osuny_static_helper.rb | 10 +++++++--- app/views/admin/research/researchers/static.html.erb | 9 +++------ app/views/admin/university/people/static.html.erb | 12 +++++------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/helpers/admin/osuny_static_helper.rb b/app/helpers/admin/osuny_static_helper.rb index 0e34d3cd29..1d6a7621b3 100644 --- a/app/helpers/admin/osuny_static_helper.rb +++ b/app/helpers/admin/osuny_static_helper.rb @@ -24,13 +24,17 @@ def prepare_media_for_static(object, key) def osuny_static_string(key, value, depth: 1) return if value.blank? - raw "#{key}: >-\n #{prepare_text_for_static(value, depth: depth)}" + indentation = ' ' * (depth-1) + prepared = prepare_text_for_static(value) + raw "#{indentation}#{key}: >-\n#{indentation} #{prepared}" end - def osuny_static_html(key, value) + def osuny_static_html(key, value, depth: 1) text = strip_tags(value.to_s) return if text.blank? - raw "#{key}: >-\n #{prepare_html_for_static(value)}" + indentation = ' ' * (depth-1) + prepared = prepare_html_for_static(value) + raw "#{indentation}#{key}: >-\n#{indentation} #{prepared}" end end \ No newline at end of file diff --git a/app/views/admin/research/researchers/static.html.erb b/app/views/admin/research/researchers/static.html.erb index 9cae5d6416..9b63ba23c1 100644 --- a/app/views/admin/research/researchers/static.html.erb +++ b/app/views/admin/research/researchers/static.html.erb @@ -8,12 +8,9 @@ breadcrumb_title = t('university.person.facets.researcher.publications', locale: <%= render 'admin/application/static/core', about: @l10n, forced_title: title %> <%= render 'admin/application/static/breadcrumbs', about: person_l10n, last_item: breadcrumb_title %> <%= render 'admin/application/static/design', about: person, l10n: @l10n, full_width: true, toc_offcanvas: true %> -person: >- - <%= person_l10n.to_s %> -first_name: >- - <%= person_l10n.first_name %> -last_name: >- - <%= person_l10n.last_name %> +<%= osuny_static_string 'person', person_l10n.to_s %> +<%= osuny_static_string 'first_name', person_l10n.first_name %> +<%= osuny_static_string 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/meta_description/static', about: person_l10n %> <%= render 'admin/application/summary/static', about: person_l10n %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index 162ee3cf69..a468de32ae 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -7,8 +7,7 @@ language = @l10n.language cache_key = [person, @l10n, @website&.id, version] cache cache_key do %>--- -linkTitle: >- - <%= @l10n.to_s_alphabetical %> +<%= osuny_static_string 'linkTitle', @l10n.to_s_alphabetical %> <%= render 'admin/application/static/core', about: @l10n %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> <%= render 'admin/application/static/design', @@ -19,9 +18,9 @@ linkTitle: >- <%= render 'admin/application/meta_description/static', about: @l10n %> <%= render 'admin/application/summary/static', about: @l10n %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= osuny_static_string 'person', person_l10n.to_s %> -<%= osuny_static_string 'first_name', person_l10n.first_name %> -<%= osuny_static_string 'last_name', person_l10n.last_name %> +<%= osuny_static_string 'person', @l10n.to_s %> +<%= osuny_static_string 'first_name', @l10n.first_name %> +<%= osuny_static_string 'last_name', @l10n.last_name %> <% # Peut-on supprimer les contact details à la racine ? # phone, email, twitter, linkedin, website @@ -48,8 +47,7 @@ linkTitle: >- image: id: "<%= person.best_picture.blob.id %>" alt: "" - credit: >- - <%= prepare_html_for_static @l10n.picture_credit %> +<%= osuny_static_html 'credit', @l10n.picture_credit, depth: 2 %> <% end %> roles: <% if @l10n.author.should_sync_to?(@website) %> From 067f0925966c7c741146bdb7b38df3ea6ca6eae1 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 20:18:30 +0100 Subject: [PATCH 04/14] wip --- app/helpers/admin/osuny_static_helper.rb | 2 +- .../administration/locations/static.html.erb | 5 +-- .../categories/static/_category.html.erb | 3 +- .../static/_category_with_count.html.erb | 3 +- .../admin/application/static/_core.html.erb | 2 + .../education/programs/_static_list.html.erb | 5 +-- .../research/researchers/static.html.erb | 6 +-- .../people/administrators/static.html.erb | 6 +-- .../admin/university/people/static.html.erb | 40 ++++++++----------- 9 files changed, 32 insertions(+), 40 deletions(-) diff --git a/app/helpers/admin/osuny_static_helper.rb b/app/helpers/admin/osuny_static_helper.rb index 1d6a7621b3..e36492f173 100644 --- a/app/helpers/admin/osuny_static_helper.rb +++ b/app/helpers/admin/osuny_static_helper.rb @@ -22,7 +22,7 @@ def prepare_media_for_static(object, key) '' end - def osuny_static_string(key, value, depth: 1) + def osuny_static_text(key, value, depth: 1) return if value.blank? indentation = ' ' * (depth-1) prepared = prepare_text_for_static(value) diff --git a/app/views/admin/administration/locations/static.html.erb b/app/views/admin/administration/locations/static.html.erb index f180b43339..fdd91f0f81 100644 --- a/app/views/admin/administration/locations/static.html.erb +++ b/app/views/admin/administration/locations/static.html.erb @@ -33,12 +33,11 @@ location.diplomas.ordered.each do |diploma| hugo = l10n.hugo(@website) next if hugo.file.blank? %> - - name: >- - <%= l10n.to_s %> - permalink: "<%= hugo.permalink %>" + - permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" file: "<%= hugo.file %>" +<%= osuny_static_text 'name', l10n.to_s, depth: 3 %> programs: <%= render 'admin/education/programs/static_list', diploma: diploma, diff --git a/app/views/admin/application/categories/static/_category.html.erb b/app/views/admin/application/categories/static/_category.html.erb index d581605ab8..1a8c960203 100644 --- a/app/views/admin/application/categories/static/_category.html.erb +++ b/app/views/admin/application/categories/static/_category.html.erb @@ -5,8 +5,7 @@ if category_l10n.present? if hugo.file.present? %> <%= render 'admin/application/static/hugo/single', hugo: hugo, depth: 3 %> - name: >- - <%= prepare_text_for_static category_l10n.to_s %> +<%= osuny_static_text 'name', category_l10n.to_s, depth: 5 %> <% end end diff --git a/app/views/admin/application/categories/static/_category_with_count.html.erb b/app/views/admin/application/categories/static/_category_with_count.html.erb index 16820c75c6..f655dc2007 100644 --- a/app/views/admin/application/categories/static/_category_with_count.html.erb +++ b/app/views/admin/application/categories/static/_category_with_count.html.erb @@ -5,8 +5,7 @@ if category_l10n.present? count = category.count_objects_in(language, @website) if hugo.file.present? && count > 0 %> <%= render 'admin/application/static/hugo/single', hugo: hugo, depth: 3 %> - name: >- - <%= prepare_text_for_static category_l10n.to_s %> count: <%= count %> +<%= osuny_static_text 'name', category_l10n.to_s, depth: 5 %> <% end end %> \ No newline at end of file diff --git a/app/views/admin/application/static/_core.html.erb b/app/views/admin/application/static/_core.html.erb index cb566650ca..157f618124 100644 --- a/app/views/admin/application/static/_core.html.erb +++ b/app/views/admin/application/static/_core.html.erb @@ -84,7 +84,9 @@ search: <% if about.respond_to?(:about_id) %> about_id: "<%= about.about_id %>" <% end %> +<% if hugo %> url: "<%= hugo.permalink %>" +<% end %> kind: "<%= about.class.model_name %>" <% if about.respond_to?(:language) && about.language.present? %> lang: "<%= about.language.iso_code %>" diff --git a/app/views/admin/education/programs/_static_list.html.erb b/app/views/admin/education/programs/_static_list.html.erb index 9af62b9b11..50561c62f4 100644 --- a/app/views/admin/education/programs/_static_list.html.erb +++ b/app/views/admin/education/programs/_static_list.html.erb @@ -9,12 +9,11 @@ indentation = ' ' * depth hugo = program_l10n.hugo(@website) next if hugo.file.blank? %> -<%= indentation %>- label: >- -<%= indentation %> <%= program_l10n.to_s %> -<%= indentation %> permalink: "<%= hugo.permalink %>" +<%= indentation %>- permalink: "<%= hugo.permalink %>" <%= indentation %> path: "<%= hugo.path %>" <%= indentation %> slug: "<%= hugo.slug %>" <%= indentation %> file: "<%= hugo.file %>" +<%= osuny_static_text 'label', program_l10n.to_s, depth: (depth-1) %> <% children = program.children.published_now_in(language).where(diploma: diploma) # Limit to a global list of programs, for example on a location diff --git a/app/views/admin/research/researchers/static.html.erb b/app/views/admin/research/researchers/static.html.erb index 9b63ba23c1..a6f38672fc 100644 --- a/app/views/admin/research/researchers/static.html.erb +++ b/app/views/admin/research/researchers/static.html.erb @@ -8,9 +8,9 @@ breadcrumb_title = t('university.person.facets.researcher.publications', locale: <%= render 'admin/application/static/core', about: @l10n, forced_title: title %> <%= render 'admin/application/static/breadcrumbs', about: person_l10n, last_item: breadcrumb_title %> <%= render 'admin/application/static/design', about: person, l10n: @l10n, full_width: true, toc_offcanvas: true %> -<%= osuny_static_string 'person', person_l10n.to_s %> -<%= osuny_static_string 'first_name', person_l10n.first_name %> -<%= osuny_static_string 'last_name', person_l10n.last_name %> +<%= osuny_static_text 'person', person_l10n.to_s %> +<%= osuny_static_text 'first_name', person_l10n.first_name %> +<%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/meta_description/static', about: person_l10n %> <%= render 'admin/application/summary/static', about: person_l10n %> diff --git a/app/views/admin/university/people/administrators/static.html.erb b/app/views/admin/university/people/administrators/static.html.erb index 5b92f9d854..a78d4b38d0 100644 --- a/app/views/admin/university/people/administrators/static.html.erb +++ b/app/views/admin/university/people/administrators/static.html.erb @@ -13,9 +13,9 @@ breadcrumb_title = t('university.person.facets.administrator.responsabilities', l10n: @l10n, full_width: true, toc_offcanvas: true %> -<%= osuny_static_string 'person', person_l10n.to_s %> -<%= osuny_static_string 'first_name', person_l10n.first_name %> -<%= osuny_static_string 'last_name', person_l10n.last_name %> +<%= osuny_static_text 'person', person_l10n.to_s %> +<%= osuny_static_text 'first_name', person_l10n.first_name %> +<%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/meta_description/static', about: person_l10n %> <%= render 'admin/application/summary/static', about: person_l10n %> diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index a468de32ae..0cc55201c6 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -7,7 +7,7 @@ language = @l10n.language cache_key = [person, @l10n, @website&.id, version] cache cache_key do %>--- -<%= osuny_static_string 'linkTitle', @l10n.to_s_alphabetical %> +<%= osuny_static_text 'linkTitle', @l10n.to_s_alphabetical %> <%= render 'admin/application/static/core', about: @l10n %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> <%= render 'admin/application/static/design', @@ -18,27 +18,27 @@ cache cache_key do <%= render 'admin/application/meta_description/static', about: @l10n %> <%= render 'admin/application/summary/static', about: @l10n %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= osuny_static_string 'person', @l10n.to_s %> -<%= osuny_static_string 'first_name', @l10n.first_name %> -<%= osuny_static_string 'last_name', @l10n.last_name %> +<%= osuny_static_text 'person', @l10n.to_s %> +<%= osuny_static_text 'first_name', @l10n.first_name %> +<%= osuny_static_text 'last_name', @l10n.last_name %> <% # Peut-on supprimer les contact details à la racine ? # phone, email, twitter, linkedin, website # Ils devraient être déjà dans admin/application/contact_details/static %> <% if person.phone_mobile_is_public? %> -<%= osuny_static_string 'phone', person.phone_mobile %> +<%= osuny_static_text 'phone', person.phone_mobile %> <% end %> <% if person.email_is_public? %> -<%= osuny_static_string 'email', person.email %> +<%= osuny_static_text 'email', person.email %> <% end %> <% if person.twitter_is_public? %> -<%= osuny_static_string 'twitter', person.twitter %> +<%= osuny_static_text 'twitter', @l10n.twitter %> <% end %> <% if person.linkedin_is_public? %> -<%= osuny_static_string 'linkedin', person.linkedin %> +<%= osuny_static_text 'linkedin', @l10n.linkedin %> <% end %> -<%= osuny_static_string 'website', @l10n.url %> +<%= osuny_static_text 'website', @l10n.url %> <%= render 'admin/application/contact_details/static', about: person, l10n: @l10n, @@ -74,14 +74,12 @@ teachings: next if hugo.file.blank? %> - program: - title: >- - <%= program_l10n.to_s %> permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" file: "<%= hugo.file %>" - description: >- - <%= involvement_l10n.description %> +<%= osuny_static_text 'title', program_l10n.to_s, depth: 4 %> +<%= osuny_static_text 'description', involvement_l10n.description, depth: 3 %> <% end %> <% end %> <% if person.roles_as_administrator.any? %> @@ -95,15 +93,13 @@ administrative_missions: hugo = target_l10n.hugo(@website) next if hugo.file.blank? %> - - description: >- - <%= role_l10n.to_s %> - target: - title: >- - <%= target_l10n.to_s %> + - target: permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" file: "<%= hugo.file %>" +<%= osuny_static_text 'title', target_l10n.to_s, depth: 4 %> +<%= osuny_static_text 'description', role_l10n.to_s, depth: 3 %> <% end %> <% end %> cohorts: @@ -114,12 +110,11 @@ cohorts: hugo = cohort_l10n.hugo(@website) next if hugo.file.blank? %> - - title: >- - <%= cohort_l10n.to_s %> - permalink: "<%= hugo.permalink %>" + - permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" file: "<%= hugo.file %>" +<%= osuny_static_text 'title', cohort_l10n.to_s, depth: 3 %> <% end %> <%= render 'admin/application/connections/backlinks', about: @l10n %> <%= render 'admin/application/categories/widget/static', @@ -127,8 +122,7 @@ cohorts: l10n: @l10n, categories: university.person_categories, key: :persons_categories %> -biography: >- - <%= prepare_html_for_static @l10n.biography %> +<%= osuny_static_html 'biography', @l10n.biography %> <%= render 'admin/communication/contents/static', about: @l10n %> --- <% end %> \ No newline at end of file From c3cb5f0395f2b01d0163c767ed0a9c3fd4baffde Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 20:38:07 +0100 Subject: [PATCH 05/14] wip --- app/services/osuny/address_formatter.rb | 4 +++ .../categories/widget/_static.html.erb | 14 +++++----- .../connections/_backlinks.html.erb | 12 ++++----- .../static/_postal_address.html.erb | 26 +++++++------------ 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/app/services/osuny/address_formatter.rb b/app/services/osuny/address_formatter.rb index a30fb9058a..b6d861a3db 100644 --- a/app/services/osuny/address_formatter.rb +++ b/app/services/osuny/address_formatter.rb @@ -32,6 +32,10 @@ def city about.try(:city) end + def country? + country.present? + end + def country country_object&.to_s || country_string end diff --git a/app/views/admin/application/categories/widget/_static.html.erb b/app/views/admin/application/categories/widget/_static.html.erb index 7a58ef3060..2d92679ef8 100644 --- a/app/views/admin/application/categories/widget/_static.html.erb +++ b/app/views/admin/application/categories/widget/_static.html.erb @@ -31,10 +31,11 @@ taxonomies: <% # First, all free categories in a "fake" taxonomy if free_categories_content.present? %> - - name: >- - <%= t('category.title') %> - slug: "" + - permalink: "" path: "" + slug: "" + file: "" +<%= osuny_static_text 'name', t('category.title'), depth: 3 %> categories: <%= free_categories_content.html_safe %> <% end %> @@ -52,10 +53,11 @@ taxonomies: language: language }.join('') if taxonomy_content.present? %> - - name: >- - <%= prepare_text_for_static taxonomy_l10n.to_s %> - slug: "<%= hugo.slug %>" + - permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" + slug: "<%= hugo.slug %>" + file: "<%= hugo.file %>" +<%= osuny_static_text 'name', taxonomy_l10n.to_s, depth: 3 %> categories: <%= taxonomy_content.html_safe %> <% diff --git a/app/views/admin/application/connections/_backlinks.html.erb b/app/views/admin/application/connections/_backlinks.html.erb index 4cf1b83769..205ae98f24 100644 --- a/app/views/admin/application/connections/_backlinks.html.erb +++ b/app/views/admin/application/connections/_backlinks.html.erb @@ -8,7 +8,7 @@ backlinks = about.backlinks_for(@website) %> backlinks: current_website: - name: "<%= @website.to_s_in(language) %>" +<%= osuny_static_text 'name', @website.to_s_in(language), depth: 3 %> <% backlinks.each do |identifier, list| %> @@ -28,9 +28,8 @@ other_websites.each do |website| backlinks = about.backlinks_for(website) next if backlinks.empty? %> - - name: >- - <%= prepare_text_for_static website.to_s_in(language) %> - identifier: "<%= website.id %>" + - identifier: "<%= website.id %>" +<%= osuny_static_text 'name', website.to_s_in(language), depth: 4 %> <% backlinks.each do |identifier, list| %> @@ -41,9 +40,8 @@ other_websites.each do |website| element = object[:element] url = "#{website.url}#{hugo.permalink}" %> - - name: >- - <%= prepare_text_for_static element.to_s %> - url: "<%= url %>" + - url: "<%= url %>" +<%= osuny_static_text 'name', element.to_s, depth: 6 %> <% end end diff --git a/app/views/admin/application/contact_details/static/_postal_address.html.erb b/app/views/admin/application/contact_details/static/_postal_address.html.erb index f6edfa38f0..9246168851 100644 --- a/app/views/admin/application/contact_details/static/_postal_address.html.erb +++ b/app/views/admin/application/contact_details/static/_postal_address.html.erb @@ -10,23 +10,17 @@ should_show = is_information_public?(about, :address) <% if present && should_show %> <%= indentation %>postal_address: <%= indentation %> data: -<%= indentation %> address_name: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.address_name %> -<%= indentation %> address: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.address %> -<%= indentation %> address_additional: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.address_additional %> -<%= indentation %> zipcode: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.zipcode %> -<%= indentation %> city: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.city %> +<%= osuny_static_text 'address_name', address_formatter.address_name, depth: depth+3 %> +<%= osuny_static_text 'address', address_formatter.address, depth: depth+3 %> +<%= osuny_static_text 'address_additional', address_formatter.address_additional, depth: depth+3 %> +<%= osuny_static_text 'zipcode', address_formatter.zipcode, depth: depth+3 %> +<%= osuny_static_text 'city', address_formatter.city, depth: depth+3 %> +<% if address_formatter.country? %> <%= indentation %> country: -<%= indentation %> name: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.country %> -<%= indentation %> alpha2: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.country_alpha2 %> -<%= indentation %> alpha3: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.country_alpha3 %> +<%= osuny_static_text 'name', address_formatter.country, depth: depth+4 %> +<%= osuny_static_text 'alpha2', address_formatter.country_alpha2, depth: depth+4 %> +<%= osuny_static_text 'alpha3', address_formatter.country_alpha3, depth: depth+4 %> +<% end %> <% if about.respond_to?(:latitude) %> <%= indentation %> geolocation: <%= indentation %> latitude: <%= about.latitude %> From 1a9b5ab09cd8db4b3bfefb19efe7df899cbcd3a1 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Wed, 12 Nov 2025 20:42:03 +0100 Subject: [PATCH 06/14] wip --- .../contact_details/static/_postal_address.html.erb | 3 +-- app/views/admin/application/header_cta/_static.html.erb | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/admin/application/contact_details/static/_postal_address.html.erb b/app/views/admin/application/contact_details/static/_postal_address.html.erb index 9246168851..e946ba8738 100644 --- a/app/views/admin/application/contact_details/static/_postal_address.html.erb +++ b/app/views/admin/application/contact_details/static/_postal_address.html.erb @@ -26,8 +26,7 @@ should_show = is_information_public?(about, :address) <%= indentation %> latitude: <%= about.latitude %> <%= indentation %> longitude: <%= about.longitude %> <% end %> -<%= indentation %> text: >- -<%= indentation %> <%= prepare_text_for_static address_formatter.to_s %> +<%= osuny_static_text 'text', address_formatter.to_s, depth: depth+2 %> <%= indentation %> html: >- <%= indentation %> <%= address_formatter.to_html.html_safe %> <% end %> \ No newline at end of file diff --git a/app/views/admin/application/header_cta/_static.html.erb b/app/views/admin/application/header_cta/_static.html.erb index 051761df44..ebac711287 100644 --- a/app/views/admin/application/header_cta/_static.html.erb +++ b/app/views/admin/application/header_cta/_static.html.erb @@ -1,7 +1,6 @@ header_cta: <% if about.header_cta %> - label: >- - <%= prepare_text_for_static about.header_cta_label %> target: "<%= about.header_cta_url %>" external: <%= about.header_cta_url_external?(@website) %> +<%= osuny_static_text 'label', about.header_cta_label, depth: 2 %> <% end %> \ No newline at end of file From abf3619d45893fdc3c7faedb739041d6d771c5ae Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Fri, 14 Nov 2025 16:30:46 +0100 Subject: [PATCH 07/14] wip --- app/views/admin/application/images/featured/_static.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/admin/application/images/featured/_static.html.erb b/app/views/admin/application/images/featured/_static.html.erb index 4a7233ee41..3a2cc08774 100644 --- a/app/views/admin/application/images/featured/_static.html.erb +++ b/app/views/admin/application/images/featured/_static.html.erb @@ -5,6 +5,5 @@ if best_featured_image&.attached? image: id: "<%= best_featured_image.blob.id %>" alt: "<%= about.best_featured_image_alt %>" - credit: >- - <%= prepare_html_for_static about.best_featured_image_credit %> +<%= osuny_static_html 'credit', about.best_featured_image_credit, depth: 2 %> <% end %> From c4133c057314579e9acf4bd299782bdf31f41829 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Sat, 15 Nov 2025 08:54:35 +0100 Subject: [PATCH 08/14] wip --- .../meta_description/_static.html.erb | 3 +- .../application/static/_breadcrumbs.html.erb | 3 +- .../admin/application/static/_core.html.erb | 31 +++++-------------- .../static/attribute/_text.html.erb | 3 -- .../application/summary/_static.html.erb | 3 +- .../websites/pages/static.html.erb | 2 -- .../university/organizations/static.html.erb | 11 ++++--- 7 files changed, 17 insertions(+), 39 deletions(-) delete mode 100644 app/views/admin/application/static/attribute/_text.html.erb diff --git a/app/views/admin/application/meta_description/_static.html.erb b/app/views/admin/application/meta_description/_static.html.erb index f8cc294781..4eb707249a 100644 --- a/app/views/admin/application/meta_description/_static.html.erb +++ b/app/views/admin/application/meta_description/_static.html.erb @@ -1,2 +1 @@ -meta_description: >- - <%= prepare_text_for_static about.meta_description %> +<%= osuny_static_text 'meta_description', about.meta_description %> diff --git a/app/views/admin/application/static/_breadcrumbs.html.erb b/app/views/admin/application/static/_breadcrumbs.html.erb index 3189fd7036..ed468e3865 100644 --- a/app/views/admin/application/static/_breadcrumbs.html.erb +++ b/app/views/admin/application/static/_breadcrumbs.html.erb @@ -18,8 +18,7 @@ localizations.each do |l10n| permalink = hugo.permalink last = l10n == localizations.last %> - - title: >- - <%= title %> + - title: "<%= title %>" <% if !last || last_item.present? %> path: "<%= permalink %>" <% end %> diff --git a/app/views/admin/application/static/_core.html.erb b/app/views/admin/application/static/_core.html.erb index 157f618124..9e59468e44 100644 --- a/app/views/admin/application/static/_core.html.erb +++ b/app/views/admin/application/static/_core.html.erb @@ -17,23 +17,16 @@ end # Title and subtitle ############# %> -title: >- - <%= prepare_text_for_static title %> -<% if show_subtitle %> -subtitle: >- - <%= prepare_text_for_static about.subtitle %> -<% end %> +<%= osuny_static_text 'title', title %> +<%= osuny_static_text 'breadcrumb_title', about.try(:best_breadcrumb_title) %> +<%= osuny_static_text 'subtitle', about.try(:subtitle) %> <% ############# # Body classes ############# bodyclass_object = about.respond_to?(:about) ? about.about : about -if bodyclass_object.respond_to?(:best_bodyclass) %> -bodyclass: >- - <%= bodyclass_object.best_bodyclass %> -<% -end %> +<%= osuny_static_text 'bodyclass', bodyclass_object.try(:best_bodyclass) %> <% ############# # Permalinks @@ -91,16 +84,9 @@ search: <% if about.respond_to?(:language) && about.language.present? %> lang: "<%= about.language.iso_code %>" <% end %> - title: >- - <%= prepare_text_for_static search_title %> - <% if about.respond_to?(:summary) %> - summary: >- - <%= prepare_html_for_static about.summary %> - <% end %> - <% if about.respond_to?(:contents_full_text) %> - body: >- - <%= prepare_html_for_static simple_format(about.contents_full_text) %> - <% end %> +<%= osuny_static_text 'title', search_title, depth: 2 %> +<%= osuny_static_html 'summary', about.try(:summary), depth: 2 %> +<%= osuny_static_html 'body', simple_format(about.contents_full_text), depth: 2 if about.respond_to?(:contents_full_text) %> <% ############# # Federation @@ -114,8 +100,7 @@ federation: <% if canonical_hugo.present? %> canonical_url: <%= "#{canonical_website.url}#{canonical_hugo.permalink}" %> website: - name: >- - <%= prepare_text_for_static canonical_website.to_s_in(about.language) if about.respond_to?(:language) %> +<%= osuny_static_text 'name', canonical_website.to_s_in(about.language), depth: 3 if about.respond_to?(:language) %> url: "<%= canonical_website.url %>" hugo: permalink: "<%= canonical_hugo.permalink %>" diff --git a/app/views/admin/application/static/attribute/_text.html.erb b/app/views/admin/application/static/attribute/_text.html.erb deleted file mode 100644 index 302fde8312..0000000000 --- a/app/views/admin/application/static/attribute/_text.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%- value = about.public_send key -%> -<%= key %>: >- - <%= prepare_text_for_static value %> \ No newline at end of file diff --git a/app/views/admin/application/summary/_static.html.erb b/app/views/admin/application/summary/_static.html.erb index 1d3447bb4b..ec6e802980 100644 --- a/app/views/admin/application/summary/_static.html.erb +++ b/app/views/admin/application/summary/_static.html.erb @@ -1,2 +1 @@ -summary: >- - <%= prepare_html_for_static about.summary %> +<%= osuny_static_html 'summary', about.try(:summary) %> diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index 1126f5e367..9e173c858f 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -2,8 +2,6 @@ page = @l10n.about language = @l10n.language %>--- -breadcrumb_title: >- - <%= prepare_text_for_static @l10n.best_breadcrumb_title %> <%= render 'admin/application/static/core', about: @l10n %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> <%= render 'admin/application/static/design', diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb index 42066b37c1..ee0e0850e3 100644 --- a/app/views/admin/university/organizations/static.html.erb +++ b/app/views/admin/university/organizations/static.html.erb @@ -1,10 +1,11 @@ <% -# this version has to incremented every time you change something in the file, to invalidate the cache -version = 7 -# Pas dans le controller parce que ça se fait dans les background jobs, à partir du @about +# This version has to incremented every time you change something in the file, to invalidate the cache +version = 8 +# Next lines are not in the controller because it happens in the background jobs organization = @l10n.about university = organization.university language = @l10n.language +# @pabois @SebouChu do we still need this cache since iteration 11? cache_key = [organization, @l10n, @website.id, version] cache cache_key do %>--- @@ -21,8 +22,8 @@ cache cache_key do <%= render 'admin/application/images/shared/static', about: @l10n %> <%= render 'admin/application/summary/static', about: @l10n %> <%= render 'admin/application/connections/backlinks', about: @l10n %> -<%= render 'admin/application/static/attribute/text', about: @about, key: :long_name %> -<%= render 'admin/application/static/attribute/text', about: organization, key: :siren %> +<%= osuny_static_text 'long_name', @about.long_name %> +<%= osuny_static_text 'siren', organization.siren %> <%= osuny_static_html 'text', @l10n.text %> kind: code: "<%= organization.kind %>" From ab5bfa12901eb81ca5b3740540f80fbbc5351c41 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Sat, 15 Nov 2025 09:57:02 +0100 Subject: [PATCH 09/14] Suppression de summary/static et meta_description/static --- .../admin/administration/locations/static.html.erb | 2 +- .../admin/application/categories/static.html.erb | 4 ++-- .../application/meta_description/_static.html.erb | 1 - .../meta_description/_static.json.jbuilder | 1 - app/views/admin/application/static/_core.html.erb | 1 + .../admin/application/summary/_static.html.erb | 1 - .../admin/application/summary/_static.json.jbuilder | 1 - .../websites/agenda/events/days/static.html.erb | 10 ++++------ .../websites/agenda/events/static.html.erb | 10 ++++------ .../agenda/events/time_slots/static.html.erb | 10 ++++------ .../websites/agenda/exhibitions/static.html.erb | 10 ++++------ .../websites/jobboard/jobs/static.html.erb | 4 ++-- .../communication/websites/pages/static.html.erb | 6 ++---- .../websites/portfolio/projects/static.html.erb | 4 ++-- .../communication/websites/posts/static.html.erb | 4 ++-- app/views/admin/education/diplomas/static.html.erb | 13 ++++--------- app/views/admin/education/programs/static.html.erb | 11 ++++------- app/views/admin/education/teachers/static.html.erb | 13 +++++-------- .../admin/research/journals/papers/static.html.erb | 7 +++---- app/views/admin/research/journals/static.html.erb | 7 +++---- .../admin/research/journals/volumes/static.html.erb | 9 ++++----- .../admin/research/researchers/static.html.erb | 4 ++-- .../admin/university/organizations/static.html.erb | 4 ++-- .../people/administrators/static.html.erb | 4 ++-- .../admin/university/people/authors/static.html.erb | 13 +++++-------- app/views/admin/university/people/static.html.erb | 4 ++-- 26 files changed, 64 insertions(+), 94 deletions(-) delete mode 100644 app/views/admin/application/meta_description/_static.html.erb delete mode 100644 app/views/admin/application/meta_description/_static.json.jbuilder delete mode 100644 app/views/admin/application/summary/_static.html.erb delete mode 100644 app/views/admin/application/summary/_static.json.jbuilder diff --git a/app/views/admin/administration/locations/static.html.erb b/app/views/admin/administration/locations/static.html.erb index fdd91f0f81..df1406eee8 100644 --- a/app/views/admin/administration/locations/static.html.erb +++ b/app/views/admin/administration/locations/static.html.erb @@ -11,7 +11,7 @@ language = @l10n.language toc_offcanvas: true %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/static/hugo/collection', key: :programs, collection: location.programs.ordered(language), diff --git a/app/views/admin/application/categories/static.html.erb b/app/views/admin/application/categories/static.html.erb index a32447278c..ee06c32dbb 100644 --- a/app/views/admin/application/categories/static.html.erb +++ b/app/views/admin/application/categories/static.html.erb @@ -32,7 +32,7 @@ children: <% end %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/communication/contents/static', about: @l10n %> --- diff --git a/app/views/admin/application/meta_description/_static.html.erb b/app/views/admin/application/meta_description/_static.html.erb deleted file mode 100644 index 4eb707249a..0000000000 --- a/app/views/admin/application/meta_description/_static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= osuny_static_text 'meta_description', about.meta_description %> diff --git a/app/views/admin/application/meta_description/_static.json.jbuilder b/app/views/admin/application/meta_description/_static.json.jbuilder deleted file mode 100644 index 8c9f093c89..0000000000 --- a/app/views/admin/application/meta_description/_static.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.meta_description @about.meta_description diff --git a/app/views/admin/application/static/_core.html.erb b/app/views/admin/application/static/_core.html.erb index 9e59468e44..af440ea98a 100644 --- a/app/views/admin/application/static/_core.html.erb +++ b/app/views/admin/application/static/_core.html.erb @@ -20,6 +20,7 @@ end <%= osuny_static_text 'title', title %> <%= osuny_static_text 'breadcrumb_title', about.try(:best_breadcrumb_title) %> <%= osuny_static_text 'subtitle', about.try(:subtitle) %> +<%= osuny_static_html 'header_text', about.try(:header_text) %> <% ############# # Body classes diff --git a/app/views/admin/application/summary/_static.html.erb b/app/views/admin/application/summary/_static.html.erb deleted file mode 100644 index ec6e802980..0000000000 --- a/app/views/admin/application/summary/_static.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= osuny_static_html 'summary', about.try(:summary) %> diff --git a/app/views/admin/application/summary/_static.json.jbuilder b/app/views/admin/application/summary/_static.json.jbuilder deleted file mode 100644 index 9c18bf9622..0000000000 --- a/app/views/admin/application/summary/_static.json.jbuilder +++ /dev/null @@ -1 +0,0 @@ -json.summary @about.summary diff --git a/app/views/admin/communication/websites/agenda/events/days/static.html.erb b/app/views/admin/communication/websites/agenda/events/days/static.html.erb index 29ea56294f..a4ac8e4219 100644 --- a/app/views/admin/communication/websites/agenda/events/days/static.html.erb +++ b/app/views/admin/communication/websites/agenda/events/days/static.html.erb @@ -22,12 +22,10 @@ language = @l10n.language <%= render 'admin/application/l10n/static', about: event_l10n %> <%= render 'admin/application/images/featured/static', about: event_l10n %> <%= render 'admin/application/images/shared/static', about: event_l10n %> -<%= render 'admin/application/meta_description/static', about: event_l10n %> -<%= render 'admin/application/summary/static', about: event_l10n %> -text: >- - <%= prepare_html_for_static event_l10n.text %> -notes: >- - <%= prepare_html_for_static event_l10n.notes %> +<%= osuny_static_text 'meta_description', event_l10n.meta_description %> +<%= osuny_static_html 'summary', event_l10n.summary %> +<%= osuny_static_html 'text', event_l10n.text %> +<%= osuny_static_html 'notes', event_l10n.notes %> <%= render 'admin/application/header_cta/static', about: event_l10n %> <%= render 'admin/application/categories/widget/static', about: event, diff --git a/app/views/admin/communication/websites/agenda/events/static.html.erb b/app/views/admin/communication/websites/agenda/events/static.html.erb index c0ed90ea43..49f5ed1733 100644 --- a/app/views/admin/communication/websites/agenda/events/static.html.erb +++ b/app/views/admin/communication/websites/agenda/events/static.html.erb @@ -21,12 +21,10 @@ day = event.days.for_language(language).ordered.first <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> -text: >- - <%= prepare_html_for_static @l10n.text %> -notes: >- - <%= prepare_html_for_static @l10n.notes %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> +<%= osuny_static_html 'text', @l10n.text %> +<%= osuny_static_html 'notes', @l10n.notes %> <%= render 'admin/application/header_cta/static', about: @l10n %> <%= render 'admin/application/categories/widget/static', about: event, diff --git a/app/views/admin/communication/websites/agenda/events/time_slots/static.html.erb b/app/views/admin/communication/websites/agenda/events/time_slots/static.html.erb index cd9181d9e2..3e45fe3af8 100644 --- a/app/views/admin/communication/websites/agenda/events/time_slots/static.html.erb +++ b/app/views/admin/communication/websites/agenda/events/time_slots/static.html.erb @@ -12,7 +12,7 @@ event_l10n = @l10n.event_l10n locale: language.iso_code %> <%= render 'admin/communication/websites/agenda/events/static/parent', event: event, language: language %> <%= render 'admin/application/images/featured/static', about: event_l10n %> -<%= render 'admin/application/summary/static', about: event_l10n %> +<%= osuny_static_html 'summary', event_l10n.summary %> <%= render 'admin/application/categories/widget/static', about: event, l10n: event_l10n, @@ -28,11 +28,9 @@ event_l10n = @l10n.event_l10n <%= render 'admin/communication/websites/agenda/events/time_slots/static/all', event: event, language: language %> <%= render 'admin/application/l10n/static', about: event_l10n %> <%= render 'admin/application/images/shared/static', about: event_l10n %> -<%= render 'admin/application/meta_description/static', about: event_l10n %> -text: >- - <%= prepare_html_for_static event_l10n.text %> -notes: >- - <%= prepare_html_for_static event_l10n.notes %> +<%= osuny_static_text 'meta_description', event_l10n %> +<%= osuny_static_html 'text', event_l10n.text %> +<%= osuny_static_html 'notes', event_l10n.notes %> <%= render 'admin/application/header_cta/static', about: event_l10n %> <%= render 'admin/communication/contents/static', about: event_l10n %> --- diff --git a/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb b/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb index 27aa1cbad6..79b48e7966 100644 --- a/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb +++ b/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb @@ -18,12 +18,10 @@ place: >- <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> -text: >- - <%= prepare_html_for_static @l10n.text %> -notes: >- - <%= prepare_html_for_static @l10n.notes %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> +<%= osuny_static_html 'text', @l10n.text %> +<%= osuny_static_html 'notes', @l10n.notes %> <%= render 'admin/application/header_cta/static', about: @l10n %> <%= render 'admin/application/categories/widget/static', about: exhibition, diff --git a/app/views/admin/communication/websites/jobboard/jobs/static.html.erb b/app/views/admin/communication/websites/jobboard/jobs/static.html.erb index f2578c2ba4..75bd15eaec 100644 --- a/app/views/admin/communication/websites/jobboard/jobs/static.html.erb +++ b/app/views/admin/communication/websites/jobboard/jobs/static.html.erb @@ -29,8 +29,8 @@ dates: <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/header_cta/static', about: @l10n %> <%= render 'admin/application/categories/widget/static', about: job, diff --git a/app/views/admin/communication/websites/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb index 9e173c858f..0da9855524 100644 --- a/app/views/admin/communication/websites/pages/static.html.erb +++ b/app/views/admin/communication/websites/pages/static.html.erb @@ -30,10 +30,8 @@ children: - "<%= child.git_path_relative %>" <% end %> <% end %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> -header_text: >- - <%= prepare_html_for_static @l10n.header_text %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/header_cta/static', about: @l10n %> <%= render 'admin/communication/websites/pages/static/section_taxonomies', page: page, language: language %> <%= render 'admin/communication/contents/static', about: @l10n %> diff --git a/app/views/admin/communication/websites/portfolio/projects/static.html.erb b/app/views/admin/communication/websites/portfolio/projects/static.html.erb index 9fb2a91d10..cf31b33b7e 100644 --- a/app/views/admin/communication/websites/portfolio/projects/static.html.erb +++ b/app/views/admin/communication/websites/portfolio/projects/static.html.erb @@ -8,8 +8,8 @@ project = @l10n.about <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/header_cta/static', about: @l10n %> year: <%= project.year %> date: <%= project.year %> diff --git a/app/views/admin/communication/websites/posts/static.html.erb b/app/views/admin/communication/websites/posts/static.html.erb index bf1f97885a..0d8e471924 100644 --- a/app/views/admin/communication/websites/posts/static.html.erb +++ b/app/views/admin/communication/websites/posts/static.html.erb @@ -20,8 +20,8 @@ authors: <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/header_cta/static', about: @l10n %> <%= render 'admin/application/categories/widget/static', about: post, diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb index 504e0df3c4..294cc03439 100644 --- a/app/views/admin/education/diplomas/static.html.erb +++ b/app/views/admin/education/diplomas/static.html.erb @@ -22,16 +22,11 @@ programs: programs: @programs, language: language %> <% end %> -short_name: >- - <%= prepare_text_for_static @l10n.short_name %> -<%= render 'admin/application/summary/static', about: @l10n %> -<% unless diploma.level_not_applicable? %> -level: >- - <%= diploma.level_i18n %> -<% end %> +<%= osuny_static_html 'short_name', @l10n.short_name %> +<%= osuny_static_html 'summary', @l10n.summary %> +<%= osuny_static_html 'level', diploma.level_i18n unless diploma.level_not_applicable? %> ects: <%= diploma.ects %> certification: <%= diploma.certification %> -duration: >- - <%= prepare_text_for_static @l10n.duration %> +<%= osuny_static_html 'duration', @l10n.duration %> <%= render 'admin/communication/contents/static', about: @l10n %> --- diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 13faaffb56..06af9629fa 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -24,13 +24,10 @@ administrator_involvements = program.involvements_through_roles <% 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 %> +<%= osuny_static_text 'website_url', @l10n.url %> +<%= osuny_static_text 'registration_url', @l10n.registration_url %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <% if @l10n.parent hugo = @l10n.parent.hugo(@website) if hugo.file.present? diff --git a/app/views/admin/education/teachers/static.html.erb b/app/views/admin/education/teachers/static.html.erb index fec9e0667b..05026e05a8 100644 --- a/app/views/admin/education/teachers/static.html.erb +++ b/app/views/admin/education/teachers/static.html.erb @@ -14,13 +14,10 @@ breadcrumb_title = t('university.person.facets.teacher.programs', locale: @l10n. l10n: @l10n, full_width: true, toc_offcanvas: true %> -person: >- - <%= person_l10n.to_s %> -first_name: >- - <%= person_l10n.first_name %> -last_name: >- - <%= person_l10n.last_name %> +<%= osuny_static_text 'person', person_l10n.to_s %> +<%= osuny_static_text 'first_name', person_l10n.first_name %> +<%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: person_l10n %> -<%= render 'admin/application/summary/static', about: person_l10n %> +<%= osuny_static_text 'meta_description', person_l10n.meta_description %> +<%= osuny_static_html 'summary', person_l10n.summary %> --- \ No newline at end of file diff --git a/app/views/admin/research/journals/papers/static.html.erb b/app/views/admin/research/journals/papers/static.html.erb index 71df9832cd..c764f0d68b 100644 --- a/app/views/admin/research/journals/papers/static.html.erb +++ b/app/views/admin/research/journals/papers/static.html.erb @@ -52,15 +52,14 @@ dates: <% if @l10n.pdf.attached? %> pdf: "<%= @l10n.pdf.blob_id %>" <% end %> -keywords: >- - <%= prepare_text_for_static @l10n.keywords %> +<%= osuny_static_text 'keywords', @l10n.keywords %> researchers: <% @l10n.people_l10n.each do |person_l10n| %> - "<%= person_l10n.slug %>" <% end %> authors_list: "<%= prepare_text_for_static @l10n.authors_list %>" -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> abstract: >- <%= prepare_text_for_static @l10n.abstract %> citations: diff --git a/app/views/admin/research/journals/static.html.erb b/app/views/admin/research/journals/static.html.erb index 63824691b9..dcf829367d 100644 --- a/app/views/admin/research/journals/static.html.erb +++ b/app/views/admin/research/journals/static.html.erb @@ -3,8 +3,7 @@ journal = @l10n.about %>--- <%= render 'admin/application/static/core', about: @l10n, skip_date: true %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> -issn: >- - <%= @l10n.issn %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'issn', @l10n.issn %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> --- diff --git a/app/views/admin/research/journals/volumes/static.html.erb b/app/views/admin/research/journals/volumes/static.html.erb index e5814d2ee9..04fbe6f32b 100644 --- a/app/views/admin/research/journals/volumes/static.html.erb +++ b/app/views/admin/research/journals/volumes/static.html.erb @@ -12,14 +12,13 @@ issn = volume.journal.best_localization_for(language).issn toc_offcanvas: false, toc_present: false %> number: <%= volume.number %> -issn: "<%= issn %>" -keywords: >- - <%= @l10n.keywords %> +<%= osuny_static_text 'issn', issn %> +<%= osuny_static_text 'keywords', @l10n.keywords %> date: "<%= @l10n.published_at.iso8601 %>" text: >- <%= prepare_html_for_static @l10n.text %> <%= render 'admin/application/images/featured/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> --- <%= prepare_html_for_static @l10n.text %> diff --git a/app/views/admin/research/researchers/static.html.erb b/app/views/admin/research/researchers/static.html.erb index a6f38672fc..ff7f63737f 100644 --- a/app/views/admin/research/researchers/static.html.erb +++ b/app/views/admin/research/researchers/static.html.erb @@ -12,6 +12,6 @@ breadcrumb_title = t('university.person.facets.researcher.publications', locale: <%= osuny_static_text 'first_name', person_l10n.first_name %> <%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: person_l10n %> -<%= render 'admin/application/summary/static', about: person_l10n %> +<%= osuny_static_text 'meta_description', person_l10n.meta_description %> +<%= osuny_static_html 'summary', person_l10n.summary %> --- \ No newline at end of file diff --git a/app/views/admin/university/organizations/static.html.erb b/app/views/admin/university/organizations/static.html.erb index ee0e0850e3..ddebffc7c5 100644 --- a/app/views/admin/university/organizations/static.html.erb +++ b/app/views/admin/university/organizations/static.html.erb @@ -17,10 +17,10 @@ cache cache_key do full_width: true, toc_offcanvas: true %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/connections/backlinks', about: @l10n %> <%= osuny_static_text 'long_name', @about.long_name %> <%= osuny_static_text 'siren', organization.siren %> diff --git a/app/views/admin/university/people/administrators/static.html.erb b/app/views/admin/university/people/administrators/static.html.erb index a78d4b38d0..d6c146d6a5 100644 --- a/app/views/admin/university/people/administrators/static.html.erb +++ b/app/views/admin/university/people/administrators/static.html.erb @@ -17,6 +17,6 @@ breadcrumb_title = t('university.person.facets.administrator.responsabilities', <%= osuny_static_text 'first_name', person_l10n.first_name %> <%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: person_l10n %> -<%= render 'admin/application/summary/static', about: person_l10n %> +<%= osuny_static_text 'meta_description', person_l10n.meta_description %> +<%= osuny_static_html 'summary', person_l10n.summary %> --- diff --git a/app/views/admin/university/people/authors/static.html.erb b/app/views/admin/university/people/authors/static.html.erb index ad1d692dc0..77288850ec 100644 --- a/app/views/admin/university/people/authors/static.html.erb +++ b/app/views/admin/university/people/authors/static.html.erb @@ -13,13 +13,10 @@ breadcrumb_title = t('university.person.facets.author.posts', locale: @l10n.lang l10n: @l10n, full_width: true, toc_offcanvas: true %> -person: >- - <%= person_l10n.to_s %> -first_name: >- - <%= person_l10n.first_name %> -last_name: >- - <%= person_l10n.last_name %> +<%= osuny_static_text 'person', person_l10n.to_s %> +<%= osuny_static_text 'first_name', person_l10n.first_name %> +<%= osuny_static_text 'last_name', person_l10n.last_name %> <%= render 'admin/application/l10n/static', about: @l10n %> -<%= render 'admin/application/meta_description/static', about: person_l10n %> -<%= render 'admin/application/summary/static', about: person_l10n %> +<%= osuny_static_text 'meta_description', person_l10n.meta_description %> +<%= osuny_static_html 'summary', person_l10n.summary %> --- \ No newline at end of file diff --git a/app/views/admin/university/people/static.html.erb b/app/views/admin/university/people/static.html.erb index 0cc55201c6..7c6e0d0b72 100644 --- a/app/views/admin/university/people/static.html.erb +++ b/app/views/admin/university/people/static.html.erb @@ -15,8 +15,8 @@ cache cache_key do l10n: @l10n, full_width: true, toc_offcanvas: true %> -<%= render 'admin/application/meta_description/static', about: @l10n %> -<%= render 'admin/application/summary/static', about: @l10n %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= osuny_static_text 'person', @l10n.to_s %> <%= osuny_static_text 'first_name', @l10n.first_name %> From d0e3adafe52f13cebaddd16f6e6b73ef5175e0cc Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Sat, 15 Nov 2025 10:01:10 +0100 Subject: [PATCH 10/14] Blocks --- .../admin/communication/blocks/_static.html.erb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/views/admin/communication/blocks/_static.html.erb b/app/views/admin/communication/blocks/_static.html.erb index b3d62c818e..d2b10dcc4a 100644 --- a/app/views/admin/communication/blocks/_static.html.erb +++ b/app/views/admin/communication/blocks/_static.html.erb @@ -4,10 +4,8 @@ should_render_data = block.data && block.data.present? %> - kind: block template: <%= block.template_kind %> - title: >- - <%= prepare_text_for_static block.title %> - slug: >- - <%= block.slug %> +<%= osuny_static_text 'title', block.title, depth: 3 %> +<%= osuny_static_text 'slug', block.slug, depth: 3 %> ranks: base: <%= block.heading_rank_base %> <% if block.heading_self? %> @@ -23,8 +21,7 @@ should_render_data = block.data && block.data.present? active: <%= block.template.top_active %> <% if block.template.top_title.present? %> title: - value: >- - <%= prepare_text_for_static block.template.top_title %> +<%= osuny_static_text 'value', block.template.top_title, depth: 5 %> heading: <%= block.template.top_heading %> <% if block.template.top_link.present? %> link: "<%= block.template.top_link %>" @@ -33,10 +30,7 @@ should_render_data = block.data && block.data.present? screen_reader_only: <%= block.template.top_screen_reader_only %> <% end %> <% end %> -<% if block.template.top_description.present? %> - description: >- - <%= prepare_html_for_static block.template.top_description %> -<% end %> +<%= osuny_static_html 'description', block.template.top_description, depth: 4 %> data: <%= render template_path, block: block, From 2484f49684368ea92f20ba3228fc3d8574bc61d1 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Sat, 15 Nov 2025 10:53:04 +0100 Subject: [PATCH 11/14] Done! (maybe) --- .../events/time_slots/static/_all.html.erb | 5 ++-- .../events/time_slots/static/_current.erb | 5 ++-- .../agenda/exhibitions/static.html.erb | 3 +- .../websites/alerts/static.html.erb | 12 +++----- .../configs/default_languages/static.html.erb | 3 +- .../_education_academic_year.html.erb | 29 +++++++++---------- .../admin/education/programs/static.html.erb | 24 +++++---------- .../admin/education/schools/static.html.erb | 3 +- .../journals/papers/kinds/static.html.erb | 3 +- .../research/journals/papers/static.html.erb | 3 +- .../research/journals/volumes/static.html.erb | 3 +- .../admin/research/publications/show.html.erb | 2 +- .../research/publications/static.html.erb | 15 ++++------ 13 files changed, 44 insertions(+), 66 deletions(-) diff --git a/app/views/admin/communication/websites/agenda/events/time_slots/static/_all.html.erb b/app/views/admin/communication/websites/agenda/events/time_slots/static/_all.html.erb index 8a90ba89ea..32b1c462c4 100644 --- a/app/views/admin/communication/websites/agenda/events/time_slots/static/_all.html.erb +++ b/app/views/admin/communication/websites/agenda/events/time_slots/static/_all.html.erb @@ -12,13 +12,14 @@ event.time_slots.ordered.each do |time_slot| date: "<%= time_slot.date&.iso8601 %>" time: "<%= time_slot.time %>" datetime: "<%= time_slot.datetime&.iso8601 %>" +<% if time_slot.end_date %> end: date: "<%= time_slot.end_date&.iso8601 %>" time: "<%= time_slot.end_time %>" datetime: "<%= time_slot.end_datetime&.iso8601 %>" +<% end %> status: "<%= time_slot.status %>" - place: >- - <%= prepare_text_for_static l10n.place %> +<%= osuny_static_text 'place', l10n.place, depth: 3 %> <%= render 'admin/communication/websites/agenda/static_add_to_calendar', l10n: l10n, depth: 2 %> <% end %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/agenda/events/time_slots/static/_current.erb b/app/views/admin/communication/websites/agenda/events/time_slots/static/_current.erb index 0fbaab5330..0c31cc6166 100644 --- a/app/views/admin/communication/websites/agenda/events/time_slots/static/_current.erb +++ b/app/views/admin/communication/websites/agenda/events/time_slots/static/_current.erb @@ -11,12 +11,13 @@ current_time_slot: date: "<%= time_slot.date&.iso8601 %>" time: "<%= time_slot.time %>" datetime: "<%= time_slot.datetime&.iso8601 %>" +<% if time_slot.end_date %> end: date: "<%= time_slot.end_date&.iso8601 %>" time: "<%= time_slot.end_time %>" datetime: "<%= time_slot.end_datetime&.iso8601 %>" +<% end %> status: "<%= time_slot.status %>" - place: >- - <%= prepare_text_for_static l10n.place %> +<%= osuny_static_text 'place', l10n.place, depth: 2 %> <%= render 'admin/communication/websites/agenda/static_add_to_calendar', l10n: l10n %> <% end %> \ No newline at end of file diff --git a/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb b/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb index 79b48e7966..ba33c6236e 100644 --- a/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb +++ b/app/views/admin/communication/websites/agenda/exhibitions/static.html.erb @@ -13,8 +13,7 @@ language = @l10n.language exhibition: exhibition, l10n: @l10n, locale: language.iso_code %> -place: >- - <%= prepare_text_for_static @l10n.place %> +<%= osuny_static_text 'place', @l10n.place %> <%= render 'admin/application/l10n/static', about: @l10n %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= render 'admin/application/images/shared/static', about: @l10n %> diff --git a/app/views/admin/communication/websites/alerts/static.html.erb b/app/views/admin/communication/websites/alerts/static.html.erb index 8da5e07b9a..03a8ef0fc2 100644 --- a/app/views/admin/communication/websites/alerts/static.html.erb +++ b/app/views/admin/communication/websites/alerts/static.html.erb @@ -2,17 +2,13 @@ alert = @l10n.about language = @l10n.language %>--- -title: >- - <%= prepare_text_for_static @l10n.to_s %> +<%= osuny_static_text 'title', @l10n.to_s %> level: <%= alert.kind %> -content: >- - <%= prepare_html_for_static @l10n.description %> +<%= osuny_static_html 'content', @l10n.description %> <% if @l10n.cta? %> button: - title: >- - <%= prepare_text_for_static @l10n.cta_label %> - url: >- - <%= @l10n.cta_url %> +<%= osuny_static_text 'title', @l10n.cta_label, depth: 2 %> +<%= osuny_static_text 'url', @l10n.cta_url, depth: 2 %> target_blank: <%= @l10n.cta_url_external?(@website) %> <% end %> --- diff --git a/app/views/admin/communication/websites/configs/default_languages/static.html.erb b/app/views/admin/communication/websites/configs/default_languages/static.html.erb index bd87fa2cb9..df9745360e 100644 --- a/app/views/admin/communication/websites/configs/default_languages/static.html.erb +++ b/app/views/admin/communication/websites/configs/default_languages/static.html.erb @@ -9,8 +9,7 @@ localizations.each do |l10n| language = l10n.language %> <%= language.iso_code %>: - title: >- - <%= l10n.to_s %> +<%= osuny_static_text 'title', l10n.to_s, depth: 2 %> contentDir: content/<%= language.iso_code %> languageCode: <%= language.iso_code %> languageName: <%= language.name %> diff --git a/app/views/admin/communication/websites/pages/static/special_pages/_education_academic_year.html.erb b/app/views/admin/communication/websites/pages/static/special_pages/_education_academic_year.html.erb index 97db0c1b50..e1613561a8 100644 --- a/app/views/admin/communication/websites/pages/static/special_pages/_education_academic_year.html.erb +++ b/app/views/admin/communication/websites/pages/static/special_pages/_education_academic_year.html.erb @@ -24,7 +24,8 @@ alumni: language: language, depth: 2 %> decades: -<% decades.each do |key, value| +<% +decades.each do |key, value| name = value[:name] years = value[:years] next if years.none? @@ -43,26 +44,24 @@ alumni: language: language, depth: 1 %> taxonomies: -<% taxonomies.each do |taxonomy| %> - <% - taxonomy_l10n = taxonomy.localization_for(language) - taxonomy_total = 0 - next if taxonomy_l10n.nil? - %> +<% taxonomies.each do |taxonomy| + taxonomy_l10n = taxonomy.localization_for(language) + taxonomy_total = 0 + next if taxonomy_l10n.nil? + %> - title: >- <%= prepare_text_for_static taxonomy_l10n.to_s %> slug: <%= taxonomy_l10n.slug %> children: -<% @website.university.person_categories.in_taxonomy(taxonomy).ordered.each do |person_category| %> - <% - person_category_l10n = person_category.localization_for(language) - category_total = @website.alumni.for_category(person_category).count - taxonomy_total += category_total - %> +<% @website.university.person_categories.in_taxonomy(taxonomy).ordered.each do |person_category| + person_category_l10n = person_category.localization_for(language) + category_total = @website.alumni.for_category(person_category).count + taxonomy_total += category_total + %> - title: >- <%= prepare_text_for_static person_category_l10n.to_s %> slug: <%= person_category_l10n.slug %> total: <%= category_total %> -<% end %> +<% end %> total: <%= taxonomy_total %> -<% end %> \ No newline at end of file +<% end %> \ No newline at end of file diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 06af9629fa..842103a00b 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -33,8 +33,7 @@ downloadable_summary: <%= @l10n.downloadable_summary.blob_id %> if hugo.file.present? %> parent: - title: >- - <%= @l10n.parent.name %> +<%= osuny_static_text 'title', @l10n.parent.name, depth: 2 %> permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" @@ -87,17 +86,12 @@ information: initial: <%= program.initial %> <% end %> pricing: - global: >- - <%= prepare_html_for_static @l10n.best_pricing %> - initial: >- - <%= prepare_html_for_static @l10n.pricing_initial %> - continuing: >- - <%= prepare_html_for_static @l10n.pricing_continuing %> - apprenticeship: >- - <%= prepare_html_for_static @l10n.pricing_apprenticeship %> +<%= osuny_static_html 'global', @l10n.best_pricing, depth: 3 %> +<%= osuny_static_html 'initial', @l10n.pricing_initial, depth: 3 %> +<%= osuny_static_html 'continuing', @l10n.pricing_continuing, depth: 3 %> +<%= osuny_static_html 'apprenticeship', @l10n.pricing_apprenticeship, depth: 3 %> diplomas: "<%= @l10n.diploma&.slug %>" -duration: >- - <%= prepare_text_for_static @l10n.duration %> +<%= osuny_static_text 'duration', @l10n.duration %> teachers: <% teacher_involvements.each do |involvement| @@ -174,10 +168,8 @@ initial: <%= program.initial %> certifications: qualiopi: certified: <%= program.qualiopi_certified %> - text: >- - <%= prepare_html_for_static @l10n.qualiopi_text %> -presentation: >- - <%= prepare_html_for_static @l10n.presentation %> +<%= osuny_static_html 'text', @l10n.qualiopi_text, depth: 3 %> +<%= osuny_static_html 'presentation', @l10n.presentation %> <% [ :accessibility, diff --git a/app/views/admin/education/schools/static.html.erb b/app/views/admin/education/schools/static.html.erb index 262a96fbcd..546c73ab8d 100644 --- a/app/views/admin/education/schools/static.html.erb +++ b/app/views/admin/education/schools/static.html.erb @@ -5,8 +5,7 @@ administrator_involvements = school.involvements_through_roles.includes(:person) %>--- <%= render 'admin/application/static/core', about: @l10n, skip_date: true %> <%= render 'admin/application/static/breadcrumbs', about: @l10n %> -address: >- - <%= prepare_text_for_static school.address %> +<%= osuny_static_text 'address', school.address %> zipcode: "<%= prepare_text_for_static school.zipcode %>" city: "<%= prepare_text_for_static school.city %>" country: "<%= prepare_text_for_static school.country_common_name %>" diff --git a/app/views/admin/research/journals/papers/kinds/static.html.erb b/app/views/admin/research/journals/papers/kinds/static.html.erb index 34d44d42d5..e4b32fae6d 100644 --- a/app/views/admin/research/journals/papers/kinds/static.html.erb +++ b/app/views/admin/research/journals/papers/kinds/static.html.erb @@ -1,5 +1,4 @@ --- -title: >- - <%= prepare_text_for_static @l10n.to_s %> +<%= osuny_static_text 'abtitlestract', @l10n.to_s %> slug: "<%= @l10n.slug %>" --- diff --git a/app/views/admin/research/journals/papers/static.html.erb b/app/views/admin/research/journals/papers/static.html.erb index c764f0d68b..9c116362cf 100644 --- a/app/views/admin/research/journals/papers/static.html.erb +++ b/app/views/admin/research/journals/papers/static.html.erb @@ -60,8 +60,7 @@ researchers: authors_list: "<%= prepare_text_for_static @l10n.authors_list %>" <%= osuny_static_text 'meta_description', @l10n.meta_description %> <%= osuny_static_html 'summary', @l10n.summary %> -abstract: >- - <%= prepare_text_for_static @l10n.abstract %> +<%= osuny_static_text 'abstract', @l10n.abstract %> citations: - label: "APA" content: >- diff --git a/app/views/admin/research/journals/volumes/static.html.erb b/app/views/admin/research/journals/volumes/static.html.erb index 04fbe6f32b..cc1b245505 100644 --- a/app/views/admin/research/journals/volumes/static.html.erb +++ b/app/views/admin/research/journals/volumes/static.html.erb @@ -15,8 +15,7 @@ number: <%= volume.number %> <%= osuny_static_text 'issn', issn %> <%= osuny_static_text 'keywords', @l10n.keywords %> date: "<%= @l10n.published_at.iso8601 %>" -text: >- - <%= prepare_html_for_static @l10n.text %> +<%= osuny_static_html 'text', @l10n.text %> <%= render 'admin/application/images/featured/static', about: @l10n %> <%= osuny_static_text 'meta_description', @l10n.meta_description %> <%= osuny_static_html 'summary', @l10n.summary %> diff --git a/app/views/admin/research/publications/show.html.erb b/app/views/admin/research/publications/show.html.erb index 051f4d3d9c..83c71c477a 100644 --- a/app/views/admin/research/publications/show.html.erb +++ b/app/views/admin/research/publications/show.html.erb @@ -41,7 +41,7 @@

<%= @publication.hal_docid %>

<% end %> - <% if @publication.anr_project_references.any? %> + <% if @publication.anr_project_references&.any? %>
<%= osuny_label Research::Publication.human_attribute_name('anr_project_references') %>
    diff --git a/app/views/admin/research/publications/static.html.erb b/app/views/admin/research/publications/static.html.erb index e4e1ec84e0..91c732d198 100644 --- a/app/views/admin/research/publications/static.html.erb +++ b/app/views/admin/research/publications/static.html.erb @@ -9,16 +9,11 @@ hal: docid: "<%= @about.hal_docid %>" url: "<%= @about.hal_url %>" -abstract: >- - <%= prepare_html_for_static @about.abstract %> -journal_title: >- - <%= prepare_text_for_static @about.journal_title %> -citation_full: >- - <%= prepare_html_for_static @about.citation_full %> -authors_list: >- - <%= prepare_html_for_static @about.authors_list %> -ref: >- - <%= sanitize @about.ref %> +<%= osuny_static_html 'abstract', @about.abstract %> +<%= osuny_static_text 'journal_title', @about.journal_title %> +<%= osuny_static_html 'citation_full', @about.citation_full %> +<%= osuny_static_html 'authors_list', @about.authors_list %> +<%= osuny_static_html 'ref', sanitize(@about.ref) %> links: - label: "HAL" url: "<%= @about.hal_url %>" From e0d234c69fc128939dc11c899eb5aecf9ad7abc6 Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Sat, 15 Nov 2025 10:55:29 +0100 Subject: [PATCH 12/14] bundle update --- Gemfile.lock | 87 ++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 471bdd8856..3f7a9a57c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,8 +125,8 @@ GEM activerecord (>= 6.0.0) activesupport (>= 6.0.0) aws-eventstream (1.4.0) - aws-partitions (1.1179.0) - aws-sdk-core (3.236.0) + aws-partitions (1.1182.0) + aws-sdk-core (3.237.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -134,10 +134,10 @@ GEM bigdecimal jmespath (~> 1, >= 1.6.1) logger - aws-sdk-kms (1.116.0) + aws-sdk-kms (1.117.0) aws-sdk-core (~> 3, >= 3.234.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.202.0) + aws-sdk-s3 (1.203.1) aws-sdk-core (~> 3, >= 3.234.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) @@ -213,7 +213,7 @@ GEM set (~> 1.1) singleton (< 1.0) time (< 1.0) - csl-styles (2.0.1) + csl-styles (2.0.2) csl (~> 2.0) csv (3.3.5) curation (2.0.3) @@ -238,7 +238,7 @@ GEM encryptor (3.0.0) enum_help (0.0.20) activesupport (>= 3.0.0) - erb (5.1.3) + erb (6.0.0) erubi (1.13.1) et-orbi (1.4.0) tzinfo @@ -252,9 +252,9 @@ GEM faraday-net_http (>= 2.0, < 3.5) json logger - faraday-cookie_jar (0.0.7) + faraday-cookie_jar (0.0.8) faraday (>= 0.8.0) - http-cookie (~> 1.0.0) + http-cookie (>= 1.0.0) faraday-encoding (0.0.6) faraday faraday-follow_redirects (0.4.0) @@ -266,8 +266,8 @@ GEM faraday (>= 0.8) faraday-multipart (1.0.4) multipart-post (~> 2) - faraday-net_http (3.4.1) - net-http (>= 0.5.0) + faraday-net_http (3.4.2) + net-http (~> 0.5) faraday-retry (2.3.2) faraday (~> 2.0) fastimage (2.4.0) @@ -312,13 +312,13 @@ GEM fugit (>= 1.11.0) railties (>= 6.1.0) thor (>= 1.0.0) - google-protobuf (4.33.0-arm64-darwin) + google-protobuf (4.33.1-arm64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.33.0-x86_64-darwin) + google-protobuf (4.33.1-x86_64-darwin) bigdecimal rake (>= 13) - google-protobuf (4.33.0-x86_64-linux-gnu) + google-protobuf (4.33.1-x86_64-linux-gnu) bigdecimal rake (>= 13) hal_openscience (0.1.0) @@ -328,7 +328,7 @@ GEM hashdiff (1.2.1) hashie (5.0.0) htmlentities (4.3.4) - http-cookie (1.0.8) + http-cookie (1.1.0) domain_name (~> 0.5) httparty (0.23.2) csv @@ -349,7 +349,7 @@ GEM invisible_captcha (2.3.0) rails (>= 5.2) io-console (0.8.1) - irb (1.15.2) + irb (1.15.3) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) @@ -363,8 +363,8 @@ GEM thor (>= 0.14, < 2.0) jsbundling-rails (1.3.1) railties (>= 6.0.0) - json (2.15.2) - json-schema (5.2.2) + json (2.16.0) + json-schema (6.0.0) addressable (~> 2.8) bigdecimal (~> 3.1) jwt (3.1.2) @@ -422,7 +422,7 @@ GEM nokogiri (~> 1.18.8) mini_magick (4.13.2) mini_mime (1.1.5) - minitest (5.26.0) + minitest (5.26.1) msgpack (1.8.0) multi_xml (0.7.2) bigdecimal (~> 3.1) @@ -431,8 +431,8 @@ GEM namae (1.2.0) racc (~> 1.7) nesty (1.0.2) - net-http (0.7.0) - uri + net-http (0.8.0) + uri (>= 0.11.1) net-imap (0.5.12) date net-protocol @@ -449,13 +449,14 @@ GEM racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) - oauth (1.1.2) + oauth (1.1.3) + base64 (~> 0.1) oauth-tty (~> 1.0, >= 1.0.6) snaky_hash (~> 2.0) version_gem (~> 1.1, >= 1.1.9) oauth-tty (1.0.6) version_gem (~> 1.1, >= 1.1.9) - oauth2 (2.0.17) + oauth2 (2.0.18) faraday (>= 0.17.3, < 4.0) jwt (>= 1.0, < 4.0) logger (~> 1.2) @@ -485,8 +486,8 @@ GEM openssl (3.3.2) orm_adapter (0.5.0) ostruct (0.6.3) - paranoia (3.0.1) - activerecord (>= 6, < 8.1) + paranoia (3.1.0) + activerecord (>= 7, < 8.2) pexels (0.5.0) requests (~> 1.0.2) pg (1.6.2-arm64-darwin) @@ -508,7 +509,7 @@ GEM nio4r (~> 2.0) raabro (1.4.0) racc (1.8.1) - rack (3.2.3) + rack (3.2.4) rack-mini-profiler (3.3.1) rack (>= 1.2.0) rack-protection (4.2.1) @@ -565,7 +566,7 @@ GEM ffi (~> 1.0) rbnacl (7.1.2) ffi (~> 1) - rdoc (6.15.0) + rdoc (6.15.1) erb psych (>= 4.0.0) tsort @@ -574,7 +575,7 @@ GEM redis-client (0.26.1) connection_pool regexp_parser (2.11.3) - reline (0.6.2) + reline (0.6.3) io-console (~> 0.5) requests (1.0.2) require_all (3.0.0) @@ -603,21 +604,21 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.6) - rswag (2.16.0) - rswag-api (= 2.16.0) - rswag-specs (= 2.16.0) - rswag-ui (= 2.16.0) - rswag-api (2.16.0) - activesupport (>= 5.2, < 8.1) - railties (>= 5.2, < 8.1) - rswag-specs (2.16.0) - activesupport (>= 5.2, < 8.1) - json-schema (>= 2.2, < 6.0) - railties (>= 5.2, < 8.1) + rswag (2.17.0) + rswag-api (= 2.17.0) + rswag-specs (= 2.17.0) + rswag-ui (= 2.17.0) + rswag-api (2.17.0) + activesupport (>= 5.2, < 8.2) + railties (>= 5.2, < 8.2) + rswag-specs (2.17.0) + activesupport (>= 5.2, < 8.2) + json-schema (>= 2.2, < 7.0) + railties (>= 5.2, < 8.2) rspec-core (>= 2.14) - rswag-ui (2.16.0) - actionpack (>= 5.2, < 8.1) - railties (>= 5.2, < 8.1) + rswag-ui (2.17.0) + actionpack (>= 5.2, < 8.2) + railties (>= 5.2, < 8.2) ruby-saml (1.18.1) nokogiri (>= 1.13.10) rexml @@ -676,7 +677,7 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - stringio (3.1.7) + stringio (3.1.8) sugar-high (0.7.3) sweetloader (0.1.6) activesupport (>= 3.0.1) @@ -703,7 +704,7 @@ GEM faraday-multipart (~> 1.0.4) httparty (~> 0.20) oauth2 (>= 2.0.8) - uri (1.1.0) + uri (1.1.1) useragent (0.16.11) vcr (6.3.1) base64 From a5709b24e4bb5504ae11c8f3cbc618306f33ba5d Mon Sep 17 00:00:00 2001 From: Arnaud Levy Date: Tue, 25 Nov 2025 12:56:11 +0100 Subject: [PATCH 13/14] fix --- .../blocks/components/rich_text/_static.html.erb | 15 ++++++++------- .../blocks/components/string/_static.html.erb | 15 ++++++++------- .../blocks/components/text/_static.html.erb | 15 ++++++++------- .../education/programs/_static_list.html.erb | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/views/admin/communication/blocks/components/rich_text/_static.html.erb b/app/views/admin/communication/blocks/components/rich_text/_static.html.erb index 0925b7b694..036d39c9e7 100644 --- a/app/views/admin/communication/blocks/components/rich_text/_static.html.erb +++ b/app/views/admin/communication/blocks/components/rich_text/_static.html.erb @@ -1,7 +1,8 @@ -<% if list %> -<%= indentation %>- <%= property %>: >- -<%= indentation %> <%= prepare_html_for_static value %> -<% else %> -<%= indentation %><%= property %>: >- -<%= indentation %> <%= prepare_html_for_static value %> -<% end %> +<% +if list && value.present? +%><%= indentation %>- <%= property %>: >- +<%= indentation %> <%= prepare_html_for_static value %><% +else +%><%= osuny_static_html property, value, depth: depth+1 %><% +end +%> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/components/string/_static.html.erb b/app/views/admin/communication/blocks/components/string/_static.html.erb index c143f75b62..64ee8c9cf4 100644 --- a/app/views/admin/communication/blocks/components/string/_static.html.erb +++ b/app/views/admin/communication/blocks/components/string/_static.html.erb @@ -1,7 +1,8 @@ -<% if list %> -<%= indentation %>- <%= property %>: >- -<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %> -<% else %> -<%= indentation %><%= property %>: >- -<%= indentation %> <%= prepare_text_for_static value, depth: depth + 1 %> -<% end %> +<% +if list && value.present? +%><%= indentation %>- <%= property %>: >- +<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %><% +else +%><%= osuny_static_text property, value, depth: depth+1 %><% +end +%> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/components/text/_static.html.erb b/app/views/admin/communication/blocks/components/text/_static.html.erb index c143f75b62..8149a14b8f 100644 --- a/app/views/admin/communication/blocks/components/text/_static.html.erb +++ b/app/views/admin/communication/blocks/components/text/_static.html.erb @@ -1,7 +1,8 @@ -<% if list %> -<%= indentation %>- <%= property %>: >- -<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %> -<% else %> -<%= indentation %><%= property %>: >- -<%= indentation %> <%= prepare_text_for_static value, depth: depth + 1 %> -<% end %> +<% +if list && value.present? +%><%= indentation %>- <%= property %>: >- +<%= indentation %> <%= prepare_text_for_static value, depth: depth + 2 %><% +else +%><%= osuny_static_text property, value, depth: depth+1 %><% +end +%> \ No newline at end of file diff --git a/app/views/admin/education/programs/_static_list.html.erb b/app/views/admin/education/programs/_static_list.html.erb index 50561c62f4..49405247e6 100644 --- a/app/views/admin/education/programs/_static_list.html.erb +++ b/app/views/admin/education/programs/_static_list.html.erb @@ -13,7 +13,7 @@ indentation = ' ' * depth <%= indentation %> path: "<%= hugo.path %>" <%= indentation %> slug: "<%= hugo.slug %>" <%= indentation %> file: "<%= hugo.file %>" -<%= osuny_static_text 'label', program_l10n.to_s, depth: (depth-1) %> +<%= osuny_static_text 'label', program_l10n.to_s, depth: depth+1 %> <% children = program.children.published_now_in(language).where(diploma: diploma) # Limit to a global list of programs, for example on a location From 2315647485cb4e5dd83a53a06e536c68d0034d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= Date: Mon, 15 Dec 2025 15:39:11 +0100 Subject: [PATCH 14/14] fix import without country --- app/services/importers/hash_to_person.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/importers/hash_to_person.rb b/app/services/importers/hash_to_person.rb index bced458546..9ed476f6ac 100644 --- a/app/services/importers/hash_to_person.rb +++ b/app/services/importers/hash_to_person.rb @@ -18,7 +18,7 @@ def initialize(university, language, hash) def valid? if @first_name.blank? && @last_name.blank? && @email.blank? @error = "An email or a name is necessary" - elsif country_not_found? + elsif @country.present? && country_not_found? @error = "Country #{@country} not found" elsif !person.valid? @error = "Unable to create the person: #{person.errors.full_messages}"