Sha256: 94c889495ea434f2d768b94092a3dc17ddd12b0c989b79f42e18e63bf66e5b76
Contents?: true
Size: 1.41 KB
Versions: 3
Compression:
Stored size: 1.41 KB
Contents
module Spider class Layout < Template # allow_blocks :HTML, :Text, :Render, :Yield, :If, :TagIf, :Each, :Pass, :Widget attr_accessor :template def init(scene) super @template = @template.is_a?(Template) ? @template : Template.new(@template) @template.init(scene) unless @template.init_done? end def render(*args) prepare_assets unless @assets_prepared super end def prepare_assets @template_assets = {:css => [], :js => []} seen = {} all_assets.each do |res| next if seen[res[:src]] seen[res[:src]] = true @template_assets[res[:type].to_sym] ||= [] @template_assets[res[:type].to_sym] << res[:src] end @content[:yield_to] = @template @scene.assets = @template_assets @assets_prepared = true end @@named_layouts = {} class << self def register_layout(name, file) @@named_layouts[name] = file end def named_layouts @@named_layouts end end def all_assets return @template.all_assets + self.assets end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spiderfw-0.5.13 | lib/spiderfw/templates/layout.rb |
spiderfw-0.5.12 | lib/spiderfw/templates/layout.rb |
spiderfw-0.5.11 | lib/spiderfw/templates/layout.rb |