Skip to content
Snippets Groups Projects
Unverified Commit 27a1ca31 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

handle blobs in git

parent 81d5cfba
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,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
......
......@@ -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
......@@ -119,6 +119,10 @@ class Communication::Website::Menu::Item < ApplicationRecord
menu.force_publish!
end
def siblings
self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id)
end
protected
def set_position
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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
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