Sha256: 212b4acc94ac2f272952811778e95b52b137fc70b7dc9dd9a966365207cadb33
Contents?: true
Size: 682 Bytes
Versions: 5
Compression:
Stored size: 682 Bytes
Contents
class PufferPages::PagePart < ActiveRecord::Base self.abstract_class = true belongs_to :page, :class_name => '::Page' validates_presence_of :name validates_uniqueness_of :name, :scope => :page_id def render(drops_or_context, page = nil) template = Liquid::Template.parse(body) result = tracker.cleanup template.render(drops_or_context, :registers => {:tracker => tracker, :page => page, :file_system => PufferPages::Liquid::FileSystem.new}) main? ? result : "<% content_for :#{name} do %>#{result}<% end %>" end def tracker @tracker ||= PufferPages::Liquid::Tracker.new end def main? name == PufferPages.primary_page_part_name end end
Version data entries
5 entries across 5 versions & 1 rubygems