Sha256: cef46302185c56e380afe1e350d1040ec58a6a3fcea7695ddbe9e985aff8164f

Contents?: true

Size: 905 Bytes

Versions: 28

Compression:

Stored size: 905 Bytes

Contents

# AttributeSection provides a place to render templates that
# will be placed as text into an attribute.

require 'volt/page/targets/base_section'

class AttributeSection
  def initialize(target, binding_name)
    @target = target
    @binding_name = binding_name
    # puts "init attr section on #{binding_name}"
  end
  
  def text=(text)
    set_content_and_rezero_bindings(text, {})
  end
  
  def html=(value)
    set_content_and_rezero_bindings(value, {})
  end
  
	# Takes in our html and bindings, and rezero's the comment names, and the
	# bindings.  Returns an updated bindings hash
	def set_content_and_rezero_bindings(html, bindings)
    if @binding_name == 'main'
      @target.html = html
    else
      @target.find_by_binding_id(@binding_name).html = html
    end
    
    return bindings
  end
  
  def remove
    node = @target.find_by_binding_id(@binding_name)
    node.remove
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
volt-0.6.5 lib/volt/page/targets/attribute_section.rb
volt-0.6.4 lib/volt/page/targets/attribute_section.rb
volt-0.6.3 lib/volt/page/targets/attribute_section.rb
volt-0.6.2 lib/volt/page/targets/attribute_section.rb
volt-0.6.1 lib/volt/page/targets/attribute_section.rb
volt-0.6.0 lib/volt/page/targets/attribute_section.rb
volt-0.5.18 lib/volt/page/targets/attribute_section.rb
volt-0.5.17 lib/volt/page/targets/attribute_section.rb
volt-0.5.16 lib/volt/page/targets/attribute_section.rb
volt-0.5.15 lib/volt/page/targets/attribute_section.rb
volt-0.5.14 lib/volt/page/targets/attribute_section.rb
volt-0.5.13 lib/volt/page/targets/attribute_section.rb
volt-0.5.12 lib/volt/page/targets/attribute_section.rb
volt-0.5.11 lib/volt/page/targets/attribute_section.rb
volt-0.5.10 lib/volt/page/targets/attribute_section.rb
volt-0.5.9 lib/volt/page/targets/attribute_section.rb
volt-0.5.8 lib/volt/page/targets/attribute_section.rb
volt-0.5.7 lib/volt/page/targets/attribute_section.rb
volt-0.5.6 lib/volt/page/targets/attribute_section.rb
volt-0.5.4 lib/volt/page/targets/attribute_section.rb