Sha256: e259136062f39269eeca41ec6381aa80d818ab906104215b2dfa223f3ff4c696

Contents?: true

Size: 913 Bytes

Versions: 35

Compression:

Stored size: 913 Bytes

Contents

require 'volt/page/targets/dom_template'

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

  def remove
    raise "not implemented"
  end

  def remove_anchors
    raise "not implemented"
  end

  def insert_anchor_before_end
    raise "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))

      return 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.gsub('<', '&lt;').gsub('>', '&gt;')} &gt; --</div>"
        bindings = {}
      end

      return set_content_and_rezero_bindings(html, bindings)
    end
  end

end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
volt-0.8.14 lib/volt/page/targets/base_section.rb
volt-0.8.13 lib/volt/page/targets/base_section.rb
volt-0.8.11 lib/volt/page/targets/base_section.rb
volt-0.8.10 lib/volt/page/targets/base_section.rb
volt-0.8.9 lib/volt/page/targets/base_section.rb
volt-0.8.8 lib/volt/page/targets/base_section.rb
volt-0.8.7 lib/volt/page/targets/base_section.rb
volt-0.8.6 lib/volt/page/targets/base_section.rb
volt-0.8.5 lib/volt/page/targets/base_section.rb
volt-0.8.4 lib/volt/page/targets/base_section.rb
volt-0.8.3 lib/volt/page/targets/base_section.rb
volt-0.8.2 lib/volt/page/targets/base_section.rb
volt-0.8.1 lib/volt/page/targets/base_section.rb
volt-0.8.0 lib/volt/page/targets/base_section.rb
volt-0.7.23 lib/volt/page/targets/base_section.rb
volt-0.7.22 lib/volt/page/targets/base_section.rb
volt-0.7.21 lib/volt/page/targets/base_section.rb
volt-0.7.20 lib/volt/page/targets/base_section.rb
volt-0.7.19 lib/volt/page/targets/base_section.rb
volt-0.7.18 lib/volt/page/targets/base_section.rb