Sha256: 3c0e3c711fe6715b01bd829bb21074bbe99467b789f5dfb4e40878be4d5c692a

Contents?: true

Size: 1.2 KB

Versions: 10

Compression:

Stored size: 1.2 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?
            @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
        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

10 entries across 10 versions & 1 rubygems

Version Path
spiderfw-0.5.10 lib/spiderfw/templates/layout.rb
spiderfw-0.5.9 lib/spiderfw/templates/layout.rb
spiderfw-0.5.7 lib/spiderfw/templates/layout.rb
spiderfw-0.5.6 lib/spiderfw/templates/layout.rb
spiderfw-0.5.5 lib/spiderfw/templates/layout.rb
spiderfw-0.5.4 lib/spiderfw/templates/layout.rb
spiderfw-0.5.3 lib/spiderfw/templates/layout.rb
spiderfw-0.5.2 lib/spiderfw/templates/layout.rb
spiderfw-0.5.1 lib/spiderfw/templates/layout.rb
spiderfw-0.5 lib/spiderfw/templates/layout.rb