From f7644f88e8b5d1f5c2611a9f99561b06172bfb0c Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Mon, 5 Dec 2022 17:32:51 +0100 Subject: [PATCH] doc --- .../website/permalink/administrator.rb | 1 + .../communication/website/permalink/author.rb | 1 + .../website/permalink/category.rb | 1 + .../website/permalink/diploma.rb | 1 + .../website/permalink/organization.rb | 1 + .../communication/website/permalink/page.rb | 3 ++- .../communication/website/permalink/person.rb | 1 + .../website/permalink/researcher.rb | 2 ++ .../website/permalink/teacher.rb | 2 ++ .../website/with_special_pages.rb | 20 +++++++++++++++++-- 10 files changed, 30 insertions(+), 3 deletions(-) diff --git a/app/models/communication/website/permalink/administrator.rb b/app/models/communication/website/permalink/administrator.rb index f6b6627f9..bdbae5e4e 100644 --- a/app/models/communication/website/permalink/administrator.rb +++ b/app/models/communication/website/permalink/administrator.rb @@ -7,6 +7,7 @@ class Communication::Website::Permalink::Administrator < Communication::Website: :administrators end + # /equipe/:slug/roles/ def self.pattern_in_website(website) "#{website.special_page(:persons).path_without_language}:slug/roles/" end diff --git a/app/models/communication/website/permalink/author.rb b/app/models/communication/website/permalink/author.rb index 2d1e7328c..b354ff140 100644 --- a/app/models/communication/website/permalink/author.rb +++ b/app/models/communication/website/permalink/author.rb @@ -8,6 +8,7 @@ class Communication::Website::Permalink::Author < Communication::Website::Permal :authors end + # /equipe/:slug/actualites/ def self.pattern_in_website(website) "#{website.special_page(:persons).path_without_language}:slug/#{website.special_page(:communication_posts).slug}/" end diff --git a/app/models/communication/website/permalink/category.rb b/app/models/communication/website/permalink/category.rb index 8e63df80b..3eb525c56 100644 --- a/app/models/communication/website/permalink/category.rb +++ b/app/models/communication/website/permalink/category.rb @@ -7,6 +7,7 @@ class Communication::Website::Permalink::Category < Communication::Website::Perm :categories end + # /actualites/:slug/ def self.pattern_in_website(website) "#{website.special_page(:communication_posts).path_without_language}:slug/" end diff --git a/app/models/communication/website/permalink/diploma.rb b/app/models/communication/website/permalink/diploma.rb index c7fa23611..44a5226fb 100644 --- a/app/models/communication/website/permalink/diploma.rb +++ b/app/models/communication/website/permalink/diploma.rb @@ -7,6 +7,7 @@ class Communication::Website::Permalink::Diploma < Communication::Website::Perma :diplomas end + # /diplomes/:slug/ def self.pattern_in_website(website) "#{website.special_page(:education_diplomas).path_without_language}:slug/" end diff --git a/app/models/communication/website/permalink/organization.rb b/app/models/communication/website/permalink/organization.rb index 8d1f62eb7..f0775c7ad 100644 --- a/app/models/communication/website/permalink/organization.rb +++ b/app/models/communication/website/permalink/organization.rb @@ -7,6 +7,7 @@ class Communication::Website::Permalink::Organization < Communication::Website:: :organizations end + # /organisations/:slug/ def self.pattern_in_website(website) "#{website.special_page(:organizations).path_without_language}:slug/" end diff --git a/app/models/communication/website/permalink/page.rb b/app/models/communication/website/permalink/page.rb index d89b68595..d65145fb0 100644 --- a/app/models/communication/website/permalink/page.rb +++ b/app/models/communication/website/permalink/page.rb @@ -6,7 +6,8 @@ class Communication::Website::Permalink::Page < Communication::Website::Permalin website.id == about.communication_website_id && about.published end - # Pages are special, there is no substitution + # /notre-institut/histoire/ + # Pages are special, there is no substitution and no pattern def published_path about.path end diff --git a/app/models/communication/website/permalink/person.rb b/app/models/communication/website/permalink/person.rb index 9728a2f8d..d84621fbe 100644 --- a/app/models/communication/website/permalink/person.rb +++ b/app/models/communication/website/permalink/person.rb @@ -7,6 +7,7 @@ class Communication::Website::Permalink::Person < Communication::Website::Permal :persons end + # /equipe/:slug/ def self.pattern_in_website(website) "#{website.special_page(:persons).path_without_language}:slug/" end diff --git a/app/models/communication/website/permalink/researcher.rb b/app/models/communication/website/permalink/researcher.rb index c255ae63b..abec7308f 100644 --- a/app/models/communication/website/permalink/researcher.rb +++ b/app/models/communication/website/permalink/researcher.rb @@ -7,6 +7,8 @@ class Communication::Website::Permalink::Researcher < Communication::Website::Pe :researchers end + # /equipe/:slug/papers/ + # FIXME def self.pattern_in_website(website) "#{website.special_page(:persons).path_without_language}:slug/papers/" end diff --git a/app/models/communication/website/permalink/teacher.rb b/app/models/communication/website/permalink/teacher.rb index 3b00b322f..d8dc2c439 100644 --- a/app/models/communication/website/permalink/teacher.rb +++ b/app/models/communication/website/permalink/teacher.rb @@ -7,6 +7,8 @@ class Communication::Website::Permalink::Teacher < Communication::Website::Perma :teachers end + # /equipe/:slug/programs/ + # FIXME def self.pattern_in_website(website) "#{website.special_page(:persons).path_without_language}:slug/programs/" end diff --git a/app/models/communication/website/with_special_pages.rb b/app/models/communication/website/with_special_pages.rb index 3da2f83c0..b4e6ec4c9 100644 --- a/app/models/communication/website/with_special_pages.rb +++ b/app/models/communication/website/with_special_pages.rb @@ -13,13 +13,29 @@ module Communication::Website::WithSpecialPages def create_missing_special_pages homepage = create_special_page('home') # first level pages with test - ['legal_terms', 'sitemap', 'privacy_policy', 'accessibility', 'communication_posts', 'education_programs', 'education_diplomas', 'research_papers', 'research_volumes', 'organizations'].each do |kind| + [ + 'legal_terms', + 'sitemap', + 'privacy_policy', + 'accessibility', + 'communication_posts', + 'education_programs', + 'education_diplomas', + 'research_papers', + 'research_volumes', + 'organizations' + ].each do |kind| create_special_page(kind, homepage.id) if public_send("has_#{kind}?") end # team pages if has_persons? persons = create_special_page('persons', homepage.id) - ['administrators', 'authors', 'researchers', 'teachers'].each do |kind| + [ + 'administrators', + 'authors', + 'researchers', + 'teachers' + ].each do |kind| create_special_page(kind, persons.id) if public_send("has_#{kind}?") end end -- GitLab