diff --git a/app/helpers/admin/application_helper.rb b/app/helpers/admin/application_helper.rb index c247a467c2..924dbc1987 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..e36492f173 --- /dev/null +++ b/app/helpers/admin/osuny_static_helper.rb @@ -0,0 +1,40 @@ +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_text(key, value, depth: 1) + return if value.blank? + indentation = ' ' * (depth-1) + prepared = prepare_text_for_static(value) + raw "#{indentation}#{key}: >-\n#{indentation} #{prepared}" + end + + def osuny_static_html(key, value, depth: 1) + text = strip_tags(value.to_s) + return if text.blank? + 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/services/osuny/address_formatter.rb b/app/services/osuny/address_formatter.rb index d0c18c6b0c..d021d32b2f 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&.common_name || country_string end diff --git a/app/views/admin/administration/locations/static.html.erb b/app/views/admin/administration/locations/static.html.erb index f180b43339..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), @@ -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.html.erb b/app/views/admin/application/categories/static.html.erb index ebe81fbe7e..7a66a797fe 100644 --- a/app/views/admin/application/categories/static.html.erb +++ b/app/views/admin/application/categories/static.html.erb @@ -33,8 +33,8 @@ children: <%= 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 %> header_text: >- <%= prepare_html_for_static @l10n.header_text %> <%= render 'admin/application/header_cta/static', about: @l10n %> 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 c4af99f176..b7d1715bf3 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 @@ -7,8 +7,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: depth %> -<%= indentation %> name: >- -<%= indentation %> <%= prepare_text_for_static category_l10n.to_s %> +<%= osuny_static_text 'name', category_l10n.to_s, depth: 5 %> <%= indentation %> count: <%= count %> <% if category.children.any? %> <%= indentation %> children: @@ -22,4 +21,4 @@ if category_l10n.present? end end end -%> \ No newline at end of file +%> 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..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 @@ -10,30 +10,23 @@ 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 %> <%= 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 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 %> 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 f8cc294781..0000000000 --- a/app/views/admin/application/meta_description/_static.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -meta_description: >- - <%= prepare_text_for_static 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/_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 cb566650ca..af440ea98a 100644 --- a/app/views/admin/application/static/_core.html.erb +++ b/app/views/admin/application/static/_core.html.erb @@ -17,23 +17,17 @@ 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) %> +<%= osuny_static_html 'header_text', about.try(:header_text) %> <% ############# # 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 @@ -84,21 +78,16 @@ 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 %>" <% 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 @@ -112,8 +101,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 deleted file mode 100644 index 1d3447bb4b..0000000000 --- a/app/views/admin/application/summary/_static.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -summary: >- - <%= prepare_html_for_static about.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/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, 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/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/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 27aa1cbad6..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,17 +13,14 @@ 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 %> -<%= 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/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/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 1126f5e367..0da9855524 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', @@ -32,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/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 79a6e61493..38c3846a6b 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? @@ -63,6 +64,6 @@ alumni: <%= prepare_text_for_static person_category_l10n.to_s %> slug: <%= person_category_l10n.slug %> total: <%= category_total %> -<% end %> +<% end %> total: <%= taxonomy_total %> <% end %> 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_list.html.erb b/app/views/admin/education/programs/_static_list.html.erb index 9af62b9b11..49405247e6 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/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 13faaffb56..842103a00b 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -24,20 +24,16 @@ 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? %> parent: - title: >- - <%= @l10n.parent.name %> +<%= osuny_static_text 'title', @l10n.parent.name, depth: 2 %> permalink: "<%= hugo.permalink %>" path: "<%= hugo.path %>" slug: "<%= hugo.slug %>" @@ -90,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| @@ -177,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/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/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 71df9832cd..9c116362cf 100644 --- a/app/views/admin/research/journals/papers/static.html.erb +++ b/app/views/admin/research/journals/papers/static.html.erb @@ -52,17 +52,15 @@ 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 %> -abstract: >- - <%= prepare_text_for_static @l10n.abstract %> +<%= osuny_static_text 'meta_description', @l10n.meta_description %> +<%= osuny_static_html 'summary', @l10n.summary %> +<%= osuny_static_text 'abstract', @l10n.abstract %> citations: - label: "APA" content: >- 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..cc1b245505 100644 --- a/app/views/admin/research/journals/volumes/static.html.erb +++ b/app/views/admin/research/journals/volumes/static.html.erb @@ -12,14 +12,12 @@ 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 %> +<%= osuny_static_html 'text', @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/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') %>