diff --git a/app/models/communication/website/permalink.rb b/app/models/communication/website/permalink.rb index 8c44020ac9fae8596659be605aa2f379bb1b8784..d3bcc73b5f93628c3926667c9ad13d7f4fa0a881 100644 --- a/app/models/communication/website/permalink.rb +++ b/app/models/communication/website/permalink.rb @@ -105,7 +105,10 @@ class Communication::Website::Permalink < ApplicationRecord # Can be overwritten (Page for example) def published_path - p = pattern + # TODO I18n doit prendre la langue du about + p = "" + p += "/#{website.languages.first.iso_code}" if website.languages.any? + p += pattern substitutions.each do |key, value| p.gsub! ":#{key}", "#{value}" end diff --git a/app/models/communication/website/permalink/administrator.rb b/app/models/communication/website/permalink/administrator.rb index a852b130b6b635ad3e2a62c673f4f6da4e1835a9..3ae3a90cfe6a3fcaa1abe86a612d13f033a2decb 100644 --- a/app/models/communication/website/permalink/administrator.rb +++ b/app/models/communication/website/permalink/administrator.rb @@ -33,6 +33,6 @@ class Communication::Website::Permalink::Administrator < Communication::Website: # /equipe/:slug/roles/ def self.pattern_in_website(website) - "#{website.special_page(:persons).path}:slug/roles/" + "/#{website.special_page(:persons).slug_with_ancestors}/:slug/roles/" end end diff --git a/app/models/communication/website/permalink/author.rb b/app/models/communication/website/permalink/author.rb index d5e2aa061a68fefd6594f99e46571e70bf8463cc..6f94a1153234aff99986b4d1532aece3a6ed58b5 100644 --- a/app/models/communication/website/permalink/author.rb +++ b/app/models/communication/website/permalink/author.rb @@ -34,6 +34,6 @@ class Communication::Website::Permalink::Author < Communication::Website::Permal # /equipe/:slug/actualites/ def self.pattern_in_website(website) - "#{website.special_page(:persons).path}:slug/#{website.special_page(:communication_posts).slug}/" + "/#{website.special_page(:persons).slug_with_ancestors}/:slug/#{website.special_page(:communication_posts).slug}/" end end diff --git a/app/models/communication/website/permalink/category.rb b/app/models/communication/website/permalink/category.rb index baf5ebd30a23bbe255f498736f309dee0dab6489..933dcd3a9ae1c27d15f7bc686ddb381f5a41432c 100644 --- a/app/models/communication/website/permalink/category.rb +++ b/app/models/communication/website/permalink/category.rb @@ -33,7 +33,7 @@ class Communication::Website::Permalink::Category < Communication::Website::Perm # /actualites/:slug/ def self.pattern_in_website(website) - "#{website.special_page(:communication_posts).path}:slug/" + "/#{website.special_page(:communication_posts).slug_with_ancestors}/:slug/" end protected diff --git a/app/models/communication/website/permalink/diploma.rb b/app/models/communication/website/permalink/diploma.rb index 0446d7323feb82a218c4174506fb98f235d3e86c..9df94320c6c38534a276262bcf44cc60552588e1 100644 --- a/app/models/communication/website/permalink/diploma.rb +++ b/app/models/communication/website/permalink/diploma.rb @@ -33,6 +33,6 @@ class Communication::Website::Permalink::Diploma < Communication::Website::Perma # /diplomes/:slug/ def self.pattern_in_website(website) - "#{website.special_page(:education_diplomas).path}:slug/" + "/#{website.special_page(:education_diplomas).slug_with_ancestors}/:slug/" end end diff --git a/app/models/communication/website/permalink/organization.rb b/app/models/communication/website/permalink/organization.rb index 00220b12d5632586773ac4d478ed6d0a341633c5..b1b20dc23dd33178ccf16377d20b6f5c91d911a0 100644 --- a/app/models/communication/website/permalink/organization.rb +++ b/app/models/communication/website/permalink/organization.rb @@ -33,6 +33,6 @@ class Communication::Website::Permalink::Organization < Communication::Website:: # /organisations/:slug/ def self.pattern_in_website(website) - "#{website.special_page(:organizations).path}:slug/" + "/#{website.special_page(:organizations).slug_with_ancestors}/:slug/" end end diff --git a/app/models/communication/website/permalink/person.rb b/app/models/communication/website/permalink/person.rb index dbe8b043a6401e717c29fe600adeb7026a53830b..95ea4ba4505a53add1a6ccc5d52d7e1a28d98189 100644 --- a/app/models/communication/website/permalink/person.rb +++ b/app/models/communication/website/permalink/person.rb @@ -33,6 +33,6 @@ class Communication::Website::Permalink::Person < Communication::Website::Permal # /equipe/:slug/ def self.pattern_in_website(website) - "#{website.special_page(:persons).path}:slug/" + "/#{website.special_page(:persons).slug_with_ancestors}/:slug/" end end diff --git a/app/models/communication/website/permalink/post.rb b/app/models/communication/website/permalink/post.rb index fdb8fcdf7e857a0922b5ab7eb53fe7471ec68881..43e79fa4f37b78dc6eef1ca9fbe499a3b746aaf9 100644 --- a/app/models/communication/website/permalink/post.rb +++ b/app/models/communication/website/permalink/post.rb @@ -33,7 +33,7 @@ class Communication::Website::Permalink::Post < Communication::Website::Permalin # /actualites/2022-10-21-un-article/ def self.pattern_in_website(website) - "#{website.special_page(:communication_posts).path}:year-:month-:day-:slug/" + "/#{website.special_page(:communication_posts).slug_with_ancestors}/:year-:month-:day-:slug/" end protected diff --git a/app/models/communication/website/permalink/program.rb b/app/models/communication/website/permalink/program.rb index 506696d7e63a4d4fdefe3e5108b19e7c73da39e6..7e4f7fd28eb1971332b6291add9bea34158b297e 100644 --- a/app/models/communication/website/permalink/program.rb +++ b/app/models/communication/website/permalink/program.rb @@ -33,6 +33,6 @@ class Communication::Website::Permalink::Program < Communication::Website::Perma # /formations/:slug/ def self.pattern_in_website(website) - "#{website.special_page(:education_programs).path}:slug/" + "/#{website.special_page(:education_programs).slug_with_ancestors}/:slug/" end end diff --git a/app/models/communication/website/permalink/researcher.rb b/app/models/communication/website/permalink/researcher.rb index e0cbf3c4419720d84f7ec041fcf69ef98f0ec9ed..a770f8e2a18d7fef93962e994204e33b206fb8ef 100644 --- a/app/models/communication/website/permalink/researcher.rb +++ b/app/models/communication/website/permalink/researcher.rb @@ -34,6 +34,6 @@ class Communication::Website::Permalink::Researcher < Communication::Website::Pe # /equipe/:slug/papers/ # FIXME def self.pattern_in_website(website) - "#{website.special_page(:persons).path}:slug/papers/" + "/#{website.special_page(:persons).slug_with_ancestors}/:slug/papers/" end end diff --git a/app/models/communication/website/permalink/teacher.rb b/app/models/communication/website/permalink/teacher.rb index ebd6ed95d8c032b500327f11da575c6a37a4c2c5..37783685b5b791e3ee3a03842d945fb4c5659d84 100644 --- a/app/models/communication/website/permalink/teacher.rb +++ b/app/models/communication/website/permalink/teacher.rb @@ -34,6 +34,6 @@ class Communication::Website::Permalink::Teacher < Communication::Website::Perma # /equipe/:slug/programs/ # FIXME def self.pattern_in_website(website) - "#{website.special_page(:persons).path}:slug/programs/" + "/#{website.special_page(:persons).slug_with_ancestors}/:slug/programs/" end end