Sha256: 9e4f30d2d363dffd68ff28e8e1be248313a1187c01ee07e9b0b6f2e79b350434

Contents?: true

Size: 1011 Bytes

Versions: 11

Compression:

Stored size: 1011 Bytes

Contents

require 'volt/page/targets/dom_template'

module Volt
  # Class to describe the interface for sections
  class BaseSection
    @@template_cache = {}

    def remove
      fail 'not implemented'
    end

    def remove_anchors
      fail 'not implemented'
    end

    def insert_anchor_before_end
      fail 'not implemented'
    end

    def set_content_to_template(page, template_name)
      if self.is_a?(DomSection)
        dom_template = (@@template_cache[template_name] ||= DomTemplate.new(page, template_name))

        set_template(dom_template)
      else
        template = page.templates[template_name]

        if template
          html     = template['html']
          bindings = template['bindings']
        else
          html     = "<div>-- &lt; missing template #{template_name.inspect.html_inspect}, make sure it's component is included in dependencies.rb &gt; --</div>"
          bindings = {}
        end

        set_content_and_rezero_bindings(html, bindings)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
volt-0.9.0.pre4 lib/volt/page/targets/base_section.rb
volt-0.9.0.pre3 lib/volt/page/targets/base_section.rb
volt-0.9.0.pre2 lib/volt/page/targets/base_section.rb
volt-0.9.0.pre1 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta9 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta8 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta7 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta6 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta5 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta4 lib/volt/page/targets/base_section.rb
volt-0.8.27.beta3 lib/volt/page/targets/base_section.rb