lib/spiderfw/templates/layout.rb in spiderfw-0.6.26 vs lib/spiderfw/templates/layout.rb in spiderfw-0.6.27
- old
+ new
@@ -13,11 +13,11 @@
@template.init(scene) unless @template.init_done?
end
def render(*args)
- $PUB_URL = Spider::HomeController.pub_url
+ $PUB_URL = Spider.home.controller.pub_url
prepare_assets unless @assets_prepared
super
end
def only_asset_profiles(*profiles)
@@ -65,20 +65,20 @@
end
end
assets[:js].each do |ass|
if ass[:cpr]
compressed = compress_javascript(ass)
- @template_assets[:js] << Spider::HomeController.pub_url+'/'+COMPILED_FOLDER+'/'+compressed
+ @template_assets[:js] << Spider.home.controller.pub_url+'/'+COMPILED_FOLDER+'/'+compressed
else
ass[:src] = ass[:cdn] if ass[:cdn] && use_cdn
@template_assets[:js] << ass[:src]
end
end
assets[:css].each do |ass|
if ass[:cpr]
compressed = compress_css(ass)
- @template_assets[:css] << Spider::HomeController.pub_url+'/'+COMPILED_FOLDER+'/'+compressed
+ @template_assets[:css] << Spider.home.controller.pub_url+'/'+COMPILED_FOLDER+'/'+compressed
else
ass[:src] = ass[:cdn] if ass[:cdn] && use_cdn
is_dyn = ass[:if_ie_lte] || ass[:media] || ass[:rel]
@template_assets[:css] << (is_dyn ? ass : ass[:src])
end
@@ -149,11 +149,11 @@
unless File.exist?(File.join(pub_dest, name))
FileUtils.cp(comp, pub_dest)
end
src = name
end
- ass[:src] = Spider::HomeController.pub_url+'/'+COMPILED_FOLDER+'/'+src
+ ass[:src] = Spider.home.controller.pub_url+'/'+COMPILED_FOLDER+'/'+src
assets[type] << ass
else # needs compression
name = ass[:compress] || @cname
unless compress_assets[type][name]
cpr = {:name => name, :assets => [], :cpr => true}
@@ -194,11 +194,11 @@
end
def all_assets
tpl_assets = @template.is_a?(Layout) ? @template.all_assets : @template.assets
- assets = tpl_assets + self.assets
+ assets = self.assets + tpl_assets
if @only_asset_profiles
assets = assets.select{ |ass| ass[:profiles] && !(ass[:profiles] & @only_asset_profiles).empty? }
end
if @no_asset_profiles
assets = assets.select{ |ass| !ass[:profiles] || (ass[:profiles] & @no_asset_profiles).empty? }
@@ -207,10 +207,10 @@
end
COMPILED_FOLDER = '_c'
def self.compiled_folder_path
- File.join(Spider::HomeController.pub_path, COMPILED_FOLDER)
+ File.join(Spider.home.controller.pub_path, COMPILED_FOLDER)
end
def asset_gettext_messages_file(path)
dir = File.dirname(path)
name = File.basename(path, '.*')