diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index 1e46fb20380b284d407fc3acc934b1d44401c21e..86ee5e1c60a6d5624ef3d3e2213479028a9b5c9d 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -89,6 +89,10 @@ class Communication::Website::Category < ApplicationRecord end end + def siblings + self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id) + end + protected def set_position diff --git a/app/models/communication/website/home.rb b/app/models/communication/website/home.rb index 0228b9258d96c54e1c5f93e6d10f58aeb1865788..52a62f20e8f90e0f35d7e394ba39eaf45a4da791 100644 --- a/app/models/communication/website/home.rb +++ b/app/models/communication/website/home.rb @@ -37,4 +37,9 @@ class Communication::Website::Home < ApplicationRecord def git_path_static 'content/_index.html' end + + def git_dependencies_static + active_storage_blobs + end + end diff --git a/app/models/communication/website/menu/item.rb b/app/models/communication/website/menu/item.rb index 5bac73f1fdf6831129270edb9c166a84d85c7e79..6327f27ba9a12c91a1d17b2d13f47b6a508bcc2b 100644 --- a/app/models/communication/website/menu/item.rb +++ b/app/models/communication/website/menu/item.rb @@ -119,6 +119,10 @@ class Communication::Website::Menu::Item < ApplicationRecord menu.sync_with_git end + def siblings + self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id) + end + protected def set_position diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 631d3b0eddb63ab2345440ae100c8a39d8a65729..365463b5c4fa4c41190b7971ebd13893d1101900 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -76,7 +76,7 @@ class Communication::Website::Page < ApplicationRecord end def git_dependencies_static - descendents + siblings + descendents + siblings + active_storage_blobs end def to_s @@ -97,6 +97,10 @@ class Communication::Website::Page < ApplicationRecord end end + def siblings + self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id) + end + protected def slug_unavailable?(slug) diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 616d3a21d5a51f8582682755d31c1e520b686e7e..c852f337c6dd19eff4bce302c268bdaeb76e3790 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -72,7 +72,7 @@ class Communication::Website::Post < ApplicationRecord end def git_dependencies_static - [author] + categories + [author] + categories + active_storage_blobs end def to_s diff --git a/app/models/concerns/with_tree.rb b/app/models/concerns/with_tree.rb index 8bfa2d5571d6533ce2c10f39786a67a30fbe7826..9d15c5e8bd07259ed853c265a6588cc0d30f57fe 100644 --- a/app/models/concerns/with_tree.rb +++ b/app/models/concerns/with_tree.rb @@ -24,7 +24,7 @@ module WithTree end def siblings - self.class.where(parent: parent, university: university, website: website).where.not(id: id) + self.class.unscoped.where(parent: parent, university: university).where.not(id: id) end def self_and_children(level) diff --git a/app/models/education/program.rb b/app/models/education/program.rb index c90e7a3a0be121691965b6bca6a052d7f11bd2cc..2a1be194430945aa60da806a35be20d9e0cbe7b3 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -111,6 +111,10 @@ class Education::Program < ApplicationRecord "content/programs/#{path}/_index.html".gsub(/\/+/, '/') end + def git_dependencies_static + active_storage_blobs + end + def update_children_paths children.each do |child| child.update_column :path, child.generated_path diff --git a/app/views/active_storage/blobs/static.html.erb b/app/views/admin/active_storage/blobs/static.html.erb similarity index 100% rename from app/views/active_storage/blobs/static.html.erb rename to app/views/admin/active_storage/blobs/static.html.erb diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index efe52fbbf55c2eb6dfa68c97ee375552c0eaab4c..c03a9137f124f312a2122874f580c618662e42e3 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -32,3 +32,13 @@ ActiveStorage::Filename.class_eval do [base_filename, extension_with_delimiter].join('') end end + +module ActiveStorageGitPathStatic + def git_path_static + "data/media/#{id[0..1]}/#{id}.yml" + end +end + +ActiveSupport::Reloader.to_prepare do + ActiveStorage::Blob.include ActiveStorageGitPathStatic +end