engine/lib/locomotive/liquid/drops/page.rb

56 lines
1.2 KiB
Ruby
Raw Normal View History

module Locomotive
module Liquid
module Drops
class Page < Base
2012-04-06 10:23:11 +00:00
delegate :title, :seo_title, :meta_keywords, :meta_description, :to => '_source'
def title
2012-04-06 10:23:11 +00:00
# TODO
# self._source.templatized? ? @context['entry']._label : self._source.title
self._source.title
end
def slug
2012-04-06 10:23:11 +00:00
# TODO
# self._source.templatized? ? self._source.content_type.slug.singularize : self._source.slug
self._source.slug
end
2011-08-14 08:34:08 +00:00
def parent
@parent ||= self._source.parent.to_liquid
end
def breadcrumbs
@breadcrumbs ||= liquify(*self._source.ancestors_and_self)
end
def children
@children ||= liquify(*self._source.children)
end
2010-06-24 09:14:08 +00:00
def fullpath
@fullpath ||= self._source.fullpath
2010-06-24 09:14:08 +00:00
end
def depth
self._source.depth
end
def listed?
self._source.listed?
end
def published?
self._source.published?
end
def before_method(meth)
self._source.editable_elements.where(:slug => meth).try(:first).try(:content)
end
end
end
end
end