Skip to content
Snippets Groups Projects
Commit 7fdaba1d authored by Arnaud Levy's avatar Arnaud Levy
Browse files

git dependencies

parent ed81096d
No related branches found
No related tags found
No related merge requests found
Showing
with 70 additions and 45 deletions
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment