2010-07-23 20:09:54 +00:00
|
|
|
module Locomotive
|
|
|
|
module Liquid
|
|
|
|
module Drops
|
2010-05-30 23:57:33 +00:00
|
|
|
class Content < Base
|
2011-07-04 17:40:14 +00:00
|
|
|
|
2011-06-23 12:57:52 +00:00
|
|
|
delegate :seo_title, :meta_keywords, :meta_description, :to => '_source'
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2011-06-03 00:25:19 +00:00
|
|
|
def _id
|
2011-06-21 00:39:59 +00:00
|
|
|
self._source._id.to_s
|
2011-06-03 00:25:19 +00:00
|
|
|
end
|
2011-09-16 03:35:40 +00:00
|
|
|
|
2011-09-16 03:37:48 +00:00
|
|
|
# Returns the next content for the parent content type.
|
|
|
|
# If no content is found, nil is returned.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# {% if article.next %}
|
|
|
|
# <a href="/articles/{{ article.next._permalink }}">Read next article</a>
|
|
|
|
# {% endif %}
|
|
|
|
#
|
2011-09-16 03:35:40 +00:00
|
|
|
def next
|
|
|
|
self._source.next.to_liquid
|
|
|
|
end
|
|
|
|
|
2011-09-16 03:37:48 +00:00
|
|
|
# Returns the previous content for the parent content type.
|
|
|
|
# If no content is found, nil is returned.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
#
|
|
|
|
# {% if article.previous %}
|
|
|
|
# <a href="/articles/{{ article.previous._permalink }}">Read previous article</a>
|
|
|
|
# {% endif %}
|
|
|
|
#
|
2011-09-16 03:35:40 +00:00
|
|
|
def previous
|
|
|
|
self._source.previous.to_liquid
|
|
|
|
end
|
2011-06-03 00:25:19 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
def before_method(meth)
|
2011-06-21 00:39:59 +00:00
|
|
|
return '' if self._source.nil?
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
if not @@forbidden_attributes.include?(meth.to_s)
|
2011-06-21 00:39:59 +00:00
|
|
|
value = self._source.send(meth)
|
2010-05-30 23:57:33 +00:00
|
|
|
end
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-07-16 20:36:07 +00:00
|
|
|
def highlighted_field_value
|
2011-06-21 00:39:59 +00:00
|
|
|
self._source.highlighted_field_value
|
2010-07-16 20:36:07 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
|
|
|
end
|
2010-05-30 23:57:33 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|
|
|
|
end
|