diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 922b75f3c618c3c55c817848433f0d978a47facf..d86e27ab555f13c90172a191352aee54b70ec209 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -123,6 +123,7 @@ class Communication::Website::Post < ApplicationRecord dependencies += categories dependencies += active_storage_blobs dependencies += git_block_dependencies + dependencies += university.communication_blocks.where(template_kind: :posts).includes(:about).map(&:about).uniq if author.present? dependencies += [author, author.author] dependencies += author.active_storage_blobs diff --git a/app/models/communication/website/with_dependencies.rb b/app/models/communication/website/with_dependencies.rb index b3a2231079d5b8458c3754d8b2cff1c3828ecf72..6bb58aae944f1de27d8b08611019d7ef7e84591a 100644 --- a/app/models/communication/website/with_dependencies.rb +++ b/app/models/communication/website/with_dependencies.rb @@ -28,7 +28,10 @@ module Communication::Website::WithDependencies def blocks @blocks ||= begin blocks = Communication::Block.where(about_type: 'Communication::Website::Page', about_id: pages) + blocks = blocks.or(Communication::Block.where(about_type: 'Communication::Website::Post', about_id: posts)) blocks = blocks.or(Communication::Block.where(about_type: 'Education::Program', about_id: education_programs)) if has_education_programs? + blocks = blocks.or(Communication::Block.where(about_type: 'Education::Diploma', about_id: education_diplomas)) if has_education_diplomas? + # TODO: Blocks from People & Organizations ? blocks end end @@ -38,7 +41,7 @@ module Communication::Website::WithDependencies end def education_diplomas - has_education_diplomas? ? about.diplomas : Education::Program.none + has_education_diplomas? ? about.diplomas : Education::Diploma.none end def education_programs @@ -170,10 +173,6 @@ module Communication::Website::WithDependencies about && about.has_education_programs? end - def has_education_diplomas? - about && about.has_education_diplomas? - end - def has_research_papers? about && about.has_research_papers? end diff --git a/app/models/education/diploma.rb b/app/models/education/diploma.rb index c75d71cc1142af8321e99d926614d104a730f0d1..34f1263f279106390791fb535b57971a3b03e053 100644 --- a/app/models/education/diploma.rb +++ b/app/models/education/diploma.rb @@ -60,7 +60,7 @@ class Education::Diploma < ApplicationRecord end def git_path(website) - "content/diplomas/#{slug}/_index.html" + "content/diplomas/#{slug}/_index.html" if for_website?(website) end def git_dependencies(website)