multi source style loading
This commit is contained in:
@ -1 +1 @@
|
||||
---[]
|
||||
--- []
|
||||
|
@ -1,7 +1,9 @@
|
||||
require "merged"
|
||||
|
||||
# directory inside /app/assets/images where the images are kept
|
||||
Merged.images_dir = "cms"
|
||||
# directory inside /app/assets/images where YOUR images are kept
|
||||
# if you change this and add own styles, you will still need a merged directory
|
||||
# for the previews (card_preview and section_preview)
|
||||
Merged.images_dir = "merged"
|
||||
|
||||
# directory where data and styles are kept
|
||||
# Notice that the data is ALWAYS inside a merged directory,
|
||||
|
@ -7,21 +7,8 @@ module Merged
|
||||
|
||||
# Directory inside the app/assets/images
|
||||
mattr_accessor :images_dir
|
||||
@@images_dir = "cms"
|
||||
|
||||
# directory in root to store data
|
||||
mattr_accessor :data_dir
|
||||
@@data_dir = "."
|
||||
|
||||
def self.load_data
|
||||
# pre-load data
|
||||
[OptionDefinition, CardStyle, SectionStyle , PageStyle,
|
||||
Card , Section , Page , Image].each {|clazz| clazz.all }
|
||||
end
|
||||
|
||||
def self.load_from( kind , path )
|
||||
return unless File.exists?(path)
|
||||
clazz = "Merged::#{kind.camelcase}".constantize
|
||||
clazz.load(YAML.load_file( path ))
|
||||
end
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ module Merged
|
||||
|
||||
initializer "after_initialize" do |app|
|
||||
ActiveSupport::Reloader.to_prepare do
|
||||
Merged.load_data
|
||||
Merged::Engine.load_data
|
||||
end
|
||||
end
|
||||
|
||||
@ -32,5 +32,17 @@ module Merged
|
||||
config.assets.precompile << kid
|
||||
end
|
||||
end
|
||||
def self.load_data
|
||||
# pre-load data
|
||||
[OptionDefinition, CardStyle, SectionStyle , PageStyle,
|
||||
Card , Section , Page , Image].each {|clazz| clazz.all }
|
||||
end
|
||||
|
||||
def self.load_from( kind , path )
|
||||
return unless File.exists?(path)
|
||||
clazz = "Merged::#{kind.camelcase}".constantize
|
||||
clazz.load(YAML.load_file( path ))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user