Sha256: c09e03bed41c0f1b03db56db2e696ad879d6dce36ea5625281540c6aa9e63e52
Contents?: true
Size: 1.11 KB
Versions: 24
Compression:
Stored size: 1.11 KB
Contents
require 'volt/page/bindings/template_binding' # Component bindings are the same as template bindings, but handle components # and do not pass their context through class ComponentBinding < TemplateBinding # The context for a component binding can be either the controller, or the # component arguments (@model), with the $page as the context. This gives # components access to the page collections. def render_template(full_path, controller_name) # TODO: at the moment a :body section and a :title will both initialize different # controllers. Maybe we should have a way to tie them together? controller = get_controller(controller_name) if controller # The user provided a controller, pass in the model as an argument (in a # sub-context) args = [] args << SubContext.new(@model) if @model current_context = controller.new(*args) else # The user didn't specify a model, create a current_context = SubContext.new(@model || {}, $page) end @current_template = TemplateRenderer.new(@target, current_context, @binding_name, full_path) end end
Version data entries
24 entries across 24 versions & 1 rubygems