engine/lib/locomotive/liquid/drops/page.rb
Paul Sponagl b13c5d1d40 added a snippet option to the liquid nav tag
this is useful if you want to render more than
just a page.title string within the nav list item.
(page.menue_image, page.menue_teaser...)
use nav snippet: "<liquid snippet>" to provide a string
or nav snippet: "<snippetname>" to load the snippet from db.

added page.<editable_field> for usage within liquid templates
2012-03-07 16:32:25 +01:00

52 lines
1.1 KiB
Ruby

module Locomotive
module Liquid
module Drops
class Page < Base
delegate :seo_title, :meta_keywords, :meta_description, :to => '_source'
def title
self._source.templatized? ? @context['content_entry']._label : self._source.title
end
def slug
self._source.templatized? ? self._source.content_type.slug.singularize : self._source.slug
end
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
def fullpath
@fullpath ||= self._source.fullpath
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