Sha256: 25e56e2ece005e829726e97acd51c6e839592f69c3cd7fda776329db1cb78945

Contents?: true

Size: 841 Bytes

Versions: 33

Compression:

Stored size: 841 Bytes

Contents

# The yield binding renders the content of a tag which passes in

require 'volt/page/bindings/base_binding'
require 'volt/page/template_renderer'

module Volt
  class YieldBinding < BaseBinding
    def initialize(volt_app, target, context, binding_name)
      super(volt_app, target, context, binding_name)

      # Get the path to the template to yield
      full_path = @context.attrs.content_template_path

      # Grab the controller for the content
      controller = @context.attrs.content_controller

      @current_template = TemplateRenderer.new(volt_app, @target, controller, @binding_name, full_path)
    end

    def remove
      if @current_template
        # Remove the template if one has been rendered, when the template binding is
        # removed.
        @current_template.remove
      end

      super
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 lib/volt/page/bindings/yield_binding.rb
volt-0.9.7.pre7 lib/volt/page/bindings/yield_binding.rb
volt-0.9.7.pre6 lib/volt/page/bindings/yield_binding.rb
volt-0.9.7.pre5 lib/volt/page/bindings/yield_binding.rb
volt-0.9.7.pre3 lib/volt/page/bindings/yield_binding.rb
volt-0.9.7.pre2 lib/volt/page/bindings/yield_binding.rb
volt-0.9.6 lib/volt/page/bindings/yield_binding.rb
volt-0.9.6.pre3 lib/volt/page/bindings/yield_binding.rb
volt-0.9.6.pre2 lib/volt/page/bindings/yield_binding.rb
volt-0.9.6.pre1 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre12 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre11 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre9 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre8 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre7 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre6 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre5 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre4 lib/volt/page/bindings/yield_binding.rb
volt-0.9.5.pre3 lib/volt/page/bindings/yield_binding.rb