diff --git a/app/models/communication/website/page/administrator.rb b/app/models/communication/website/page/administrator.rb index 93fed5bbc09b4eb62e55e6d9c2d807e9cff59186..169e5ad82659a67fce4fc1588df87d4a5575a549 100644 --- a/app/models/communication/website/page/administrator.rb +++ b/app/models/communication/website/page/administrator.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::Administrator < Communication::Website::Page "#{git_path_prefix}administrators/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.website.administrators.map(&:administrator) + ].flatten + end end diff --git a/app/models/communication/website/page/author.rb b/app/models/communication/website/page/author.rb index e04954cf04c3073f930d09f015c57a81e8c29ccb..2ef31f8af3c6282aabb0994719d95f1d64ff57ec 100644 --- a/app/models/communication/website/page/author.rb +++ b/app/models/communication/website/page/author.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::Author < Communication::Website::Page "#{git_path_prefix}authors/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.website.authors.map(&:author) + ].flatten + end end diff --git a/app/models/communication/website/page/education_diploma.rb b/app/models/communication/website/page/education_diploma.rb index 5c05e798f794d382ffcf500a2fa0aaad2c6f7544..62f304cb8103136f2eef23f95eb0a203f18851b4 100644 --- a/app/models/communication/website/page/education_diploma.rb +++ b/app/models/communication/website/page/education_diploma.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::EducationDiploma < Communication::Website::P "#{git_path_prefix}diplomas/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.education_diplomas + ].flatten + end end diff --git a/app/models/communication/website/page/education_program.rb b/app/models/communication/website/page/education_program.rb index 298a0a325c56b6cfe4fcf7b45c500edbbedef430..d06340d9a32218303212924e5bd130edcbb45cf7 100644 --- a/app/models/communication/website/page/education_program.rb +++ b/app/models/communication/website/page/education_program.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::EducationProgram < Communication::Website::P "#{git_path_prefix}programs/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.education_programs + ].flatten + end end diff --git a/app/models/communication/website/page/home.rb b/app/models/communication/website/page/home.rb index a5b8166191e2dbba8ac151b686354e07b6fd9869..032a599c3fc6215c72d200de7afc4027ffdc314b 100644 --- a/app/models/communication/website/page/home.rb +++ b/app/models/communication/website/page/home.rb @@ -45,6 +45,10 @@ class Communication::Website::Page::Home < Communication::Website::Page "#{git_path_prefix}_index.html" end + def draftable? + false + end + protected def set_slug diff --git a/app/models/communication/website/page/organization.rb b/app/models/communication/website/page/organization.rb index b6793669194e39e85c44484f8ae7b95a88317a0f..179fc2a57b0ab30a578d6acfd2f6a6735ae5508b 100644 --- a/app/models/communication/website/page/organization.rb +++ b/app/models/communication/website/page/organization.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::Organization < Communication::Website::Page "#{git_path_prefix}organizations/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.organizations + ].flatten + end end diff --git a/app/models/communication/website/page/person.rb b/app/models/communication/website/page/person.rb index 2f3baf146479fe6526b0965d24b7eee0655bae57..7777925acae83ff43bf6d27d2dfc1cba09419fdd 100644 --- a/app/models/communication/website/page/person.rb +++ b/app/models/communication/website/page/person.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::Person < Communication::Website::Page "#{git_path_prefix}persons/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.people_with_facets + ].flatten + end end diff --git a/app/models/communication/website/page/research_paper.rb b/app/models/communication/website/page/research_paper.rb index 8692c5e7984527d5f65392dae700b313fd4660f2..f3c75ad19fc1f7ca004e1aca99f049c4dfbf0246 100644 --- a/app/models/communication/website/page/research_paper.rb +++ b/app/models/communication/website/page/research_paper.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::ResearchPaper < Communication::Website::Page "#{git_path_prefix}papers/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.research_papers + ].flatten + end end diff --git a/app/models/communication/website/page/research_volume.rb b/app/models/communication/website/page/research_volume.rb index 06113453ea0652c62013d13434aef6fff89cdf20..5d5f124bd56ea99d98e0aca24c9039ddf5cad452 100644 --- a/app/models/communication/website/page/research_volume.rb +++ b/app/models/communication/website/page/research_volume.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::ResearchVolume < Communication::Website::Pag "#{git_path_prefix}volumes/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.research_volumes + ].flatten + end end diff --git a/app/models/communication/website/page/researcher.rb b/app/models/communication/website/page/researcher.rb index 184ffc29f7724c102a8fd71424098d6e0bce3def..14ac41857782d25471fe26e768526c52e96276c7 100644 --- a/app/models/communication/website/page/researcher.rb +++ b/app/models/communication/website/page/researcher.rb @@ -45,4 +45,11 @@ class Communication::Website::Page::Researcher < Communication::Website::Page "#{git_path_prefix}researchers/_index.html" end + + def git_dependencies(website) + [ + website.config_default_permalinks, + website.website.researchers.map(&:researcher) + ].flatten + end end diff --git a/app/models/communication/website/page/teacher.rb b/app/models/communication/website/page/teacher.rb index 5461b31bc81ef5e8caaf7eaf9c65668226e51140..7a36cc769d1e33ad76c9b7143fbc367f23d2dd08 100644 --- a/app/models/communication/website/page/teacher.rb +++ b/app/models/communication/website/page/teacher.rb @@ -45,4 +45,10 @@ class Communication::Website::Page::Teacher < Communication::Website::Page "#{git_path_prefix}teachers/_index.html" end + def git_dependencies(website) + [ + website.config_default_permalinks, + website.website.teachers.map(&:teacher) + ].flatten + end end diff --git a/app/models/communication/website/page/with_kind.rb b/app/models/communication/website/page/with_kind.rb index 36d449b37d82d18b97ca8f6515e6b5f2afac06dd..67460dbb1d4c6d3095d6b1c5aaa35454465919d3 100644 --- a/app/models/communication/website/page/with_kind.rb +++ b/app/models/communication/website/page/with_kind.rb @@ -2,7 +2,9 @@ module Communication::Website::Page::WithKind extend ActiveSupport::Concern included do - + # Deprecated + # Utile pour la migration, le rails app:fix + # Supprimer après seulement enum kind: { home: 0, communication_posts: 10, @@ -22,49 +24,6 @@ module Communication::Website::Page::WithKind teachers: 140 }, _prefix: 'kind' - # -> dans les nouvelles classes - SPECIAL_PAGES_WITH_GIT_SPECIAL_PATH = [ - 'communication_posts', - 'education_programs', - 'education_diplomas', - 'research_papers', - 'research_volumes', - 'organizations', - 'persons', - 'administrators', - 'authors', - 'researchers', - 'teachers' - ].freeze - - # -> dans les nouvelles classes - def has_special_git_path? - is_special_page? && SPECIAL_PAGES_WITH_GIT_SPECIAL_PATH.include?(kind) - end - - # -> dans les nouvelles classes - def special_page_git_dependencies(website) - dependencies = [website.config_default_permalinks] - case kind - when "communication_posts" - dependencies += [ - website.categories, - website.authors.map(&:author), - website.posts - ].flatten - when "education_programs", "education_diplomas", "research_papers", "organizations" - # dependencies += website.education_programs - dependencies += website.public_send(kind) - when "people" - dependencies += website.people_with_facets - when "administrators", "authors", "researchers", "teachers" - # dependencies += website.authors.map(&:author) - dependencies += website.public_send(kind).map(&kind.singularize.to_sym) - end - - dependencies - end - end end diff --git a/app/models/communication/website/page/with_type.rb b/app/models/communication/website/page/with_type.rb index 3ea32edae9cbd12970dfd2c8dfdc7786ffc062ab..52c0df179b5820ed9db11a2a596307bfc13deb96 100644 --- a/app/models/communication/website/page/with_type.rb +++ b/app/models/communication/website/page/with_type.rb @@ -32,7 +32,8 @@ module Communication::Website::Page::WithType true end + # All special pages are undeletable def deletable? - true + is_regular_page? end end \ No newline at end of file