Sha256: bc581089b23dd6a5f1d899a8073b02697de4d63864b7275b1bcb36d58bf00ece
Contents?: true
Size: 913 Bytes
Versions: 2
Compression:
Stored size: 913 Bytes
Contents
module Plate # Allow for partials within views module PartialsHelper def render(options = {}, locals = {}) path = options # If a hash is passed as the first option, use it for locals if Hash === options path = options.delete(:partial) locals = options.clone end locals.symbolize_keys! render_partial(path.to_s, locals) end protected # Create a new partial with the given options, and return its content def render_partial(path, locals) partial_name = Partial.name(self.site, path, self.file) partial = Partial.find(self.site, partial_name) if partial self.page.partials << partial unless self.page.partials.include?(partial) partial.pages << self.page unless partial.pages.include?(self.page) partial.render(locals) else nil end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plate-0.7.0.pre2 | lib/plate/helpers/partials_helper.rb |
plate-0.7.0.pre | lib/plate/helpers/partials_helper.rb |