2010-07-22 00:18:14 +00:00
|
|
|
module Locomotive
|
|
|
|
module Liquid
|
|
|
|
module Drops
|
2010-06-21 15:46:17 +00:00
|
|
|
class Page < Base
|
2011-07-04 17:40:14 +00:00
|
|
|
|
2012-04-06 10:23:11 +00:00
|
|
|
delegate :title, :seo_title, :meta_keywords, :meta_description, :to => '_source'
|
2010-07-22 00:18:14 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
def title
|
2012-04-06 10:23:11 +00:00
|
|
|
# TODO
|
|
|
|
# self._source.templatized? ? @context['entry']._label : self._source.title
|
|
|
|
self._source.title
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
2010-07-22 00:18:14 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
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
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
2011-12-22 23:45:32 +00:00
|
|
|
|
2011-08-14 08:34:08 +00:00
|
|
|
def parent
|
|
|
|
@parent ||= self._source.parent.to_liquid
|
|
|
|
end
|
2011-12-22 23:45:32 +00:00
|
|
|
|
2011-08-14 08:34:57 +00:00
|
|
|
def breadcrumbs
|
2012-02-01 01:01:42 +00:00
|
|
|
@breadcrumbs ||= liquify(*self._source.ancestors_and_self)
|
2011-08-14 08:34:57 +00:00
|
|
|
end
|
2010-07-22 00:18:14 +00:00
|
|
|
|
2010-06-21 15:46:17 +00:00
|
|
|
def children
|
2011-06-21 00:39:59 +00:00
|
|
|
@children ||= liquify(*self._source.children)
|
2010-06-21 15:46:17 +00:00
|
|
|
end
|
2010-07-22 00:18:14 +00:00
|
|
|
|
2010-06-24 09:14:08 +00:00
|
|
|
def fullpath
|
2011-06-21 00:39:59 +00:00
|
|
|
@fullpath ||= self._source.fullpath
|
2010-06-24 09:14:08 +00:00
|
|
|
end
|
2010-07-22 00:18:14 +00:00
|
|
|
|
2011-01-02 22:58:06 +00:00
|
|
|
def depth
|
2011-06-21 00:39:59 +00:00
|
|
|
self._source.depth
|
2011-01-02 22:58:06 +00:00
|
|
|
end
|
2011-12-22 23:45:32 +00:00
|
|
|
|
2011-10-04 01:35:40 +00:00
|
|
|
def listed?
|
|
|
|
self._source.listed?
|
|
|
|
end
|
2011-12-22 23:45:32 +00:00
|
|
|
|
2011-10-04 01:35:40 +00:00
|
|
|
def published?
|
|
|
|
self._source.published?
|
|
|
|
end
|
2011-01-02 22:58:06 +00:00
|
|
|
|
2012-03-06 21:55:45 +00:00
|
|
|
def before_method(meth)
|
|
|
|
self._source.editable_elements.where(:slug => meth).try(:first).try(:content)
|
|
|
|
end
|
|
|
|
|
2010-06-21 15:46:17 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|