multi source style loading

This commit is contained in:
2023-01-27 19:08:57 +02:00
parent 1270c59492
commit df67ed16b5
26 changed files with 37 additions and 33 deletions

View File

@ -65,7 +65,7 @@ module Merged
end
def asset_name
image_root + "/" + self.id.to_s + "." + self.type
Merged.images_dir + "/" + self.id.to_s + "." + self.type
end
def full_filename
@ -87,10 +87,6 @@ module Merged
end
end
def self.root
"app/assets/images/cms"
end
def init_file_size
magick_image = MiniMagick::Image.open(full_filename)
self.width = magick_image.width
@ -102,9 +98,5 @@ module Merged
"app/assets/images/" + Merged.images_dir
end
def image_root
Merged.images_dir
end
end
end

View File

@ -3,11 +3,13 @@ module Merged
# takes a little footwork, as seen below
class SharedBase < ActiveYaml::Base
def self.raw_data
paths = [ Merged::Engine.root.join("config")]
paths = [ Merged::Engine.root.join("config") , Rails.root.join(Merged.data_dir) ]
loaded_files = paths.collect do |path|
actual_filename = filename || name.tableize
full = File.join(path, "#{actual_filename}.#{extension}")
load_path(full)
got = load_path(full)
raise "#{full} contained #{got.class}, not Array" unless got.class == Array
got
end
loaded_files.sum
end