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

Merge branch 'git' of github.com:noesya/osuny into git

parents 8eec8ade 041e09eb
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,10 @@ class Communication::Website::Category < ApplicationRecord ...@@ -89,6 +89,10 @@ class Communication::Website::Category < ApplicationRecord
end end
end end
def siblings
self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id)
end
protected protected
def set_position def set_position
......
...@@ -37,4 +37,9 @@ class Communication::Website::Home < ApplicationRecord ...@@ -37,4 +37,9 @@ class Communication::Website::Home < ApplicationRecord
def git_path_static def git_path_static
'content/_index.html' 'content/_index.html'
end end
def git_dependencies_static
active_storage_blobs
end
end end
...@@ -119,6 +119,10 @@ class Communication::Website::Menu::Item < ApplicationRecord ...@@ -119,6 +119,10 @@ class Communication::Website::Menu::Item < ApplicationRecord
menu.sync_with_git menu.sync_with_git
end end
def siblings
self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id)
end
protected protected
def set_position def set_position
......
...@@ -76,7 +76,7 @@ class Communication::Website::Page < ApplicationRecord ...@@ -76,7 +76,7 @@ class Communication::Website::Page < ApplicationRecord
end end
def git_dependencies_static def git_dependencies_static
descendents + siblings descendents + siblings + active_storage_blobs
end end
def to_s def to_s
...@@ -97,6 +97,10 @@ class Communication::Website::Page < ApplicationRecord ...@@ -97,6 +97,10 @@ class Communication::Website::Page < ApplicationRecord
end end
end end
def siblings
self.class.unscoped.where(parent: parent, university: university, website: website).where.not(id: id)
end
protected protected
def slug_unavailable?(slug) def slug_unavailable?(slug)
......
...@@ -72,7 +72,7 @@ class Communication::Website::Post < ApplicationRecord ...@@ -72,7 +72,7 @@ class Communication::Website::Post < ApplicationRecord
end end
def git_dependencies_static def git_dependencies_static
[author] + categories [author] + categories + active_storage_blobs
end end
def to_s def to_s
......
...@@ -24,7 +24,7 @@ module WithTree ...@@ -24,7 +24,7 @@ module WithTree
end end
def siblings 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 end
def self_and_children(level) def self_and_children(level)
......
...@@ -111,6 +111,10 @@ class Education::Program < ApplicationRecord ...@@ -111,6 +111,10 @@ class Education::Program < ApplicationRecord
"content/programs/#{path}/_index.html".gsub(/\/+/, '/') "content/programs/#{path}/_index.html".gsub(/\/+/, '/')
end end
def git_dependencies_static
active_storage_blobs
end
def update_children_paths def update_children_paths
children.each do |child| children.each do |child|
child.update_column :path, child.generated_path child.update_column :path, child.generated_path
......
...@@ -32,3 +32,13 @@ ActiveStorage::Filename.class_eval do ...@@ -32,3 +32,13 @@ ActiveStorage::Filename.class_eval do
[base_filename, extension_with_delimiter].join('') [base_filename, extension_with_delimiter].join('')
end end
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