Sha256: fac2aff8233126be93948c32c45402ebfacd324ab1908bd52fd079cfedab0709

Contents?: true

Size: 835 Bytes

Versions: 13

Compression:

Stored size: 835 Bytes

Contents

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

require 'volt/templates/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
  
	# 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

13 entries across 13 versions & 1 rubygems

Version Path
volt-0.3.7 lib/volt/templates/targets/attribute_section.rb
volt-0.3.6 lib/volt/templates/targets/attribute_section.rb
volt-0.3.5 lib/volt/templates/targets/attribute_section.rb
volt-0.3.4 lib/volt/templates/targets/attribute_section.rb
volt-0.3.3 lib/volt/templates/targets/attribute_section.rb
volt-0.3.2 lib/volt/templates/targets/attribute_section.rb
volt-0.3.1 lib/volt/templates/targets/attribute_section.rb
volt-0.3.0 lib/volt/templates/targets/attribute_section.rb
volt-0.2.9 lib/volt/templates/targets/attribute_section.rb
volt-0.2.7 lib/volt/templates/targets/attribute_section.rb
volt-0.2.5 lib/volt/templates/targets/attribute_section.rb
volt-0.2.4 lib/volt/templates/targets/attribute_section.rb
volt-0.2.3 lib/volt/templates/targets/attribute_section.rb