Class: Locomotive::Liquid::Drops::ContentEntry
- Defined in:
- lib/locomotive/liquid/drops/content_entry.rb
Instance Method Summary collapse
- #_id ⇒ Object
- #_label ⇒ Object
- #before_method(meth) ⇒ Object
- #errors ⇒ Object
-
#next ⇒ Object
Returns the next content for the parent content type.
-
#previous ⇒ Object
Returns the previous content for the parent content type.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Locomotive::Liquid::Drops::Base
Instance Method Details
#_id ⇒ Object
8 9 10 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 8 def _id @_source._id.to_s end |
#_label ⇒ Object
12 13 14 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 12 def _label @_label ||= @_source._label end |
#before_method(meth) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 46 def before_method(meth) return '' if @_source.nil? if not @@forbidden_attributes.include?(meth.to_s) value = @_source.send(meth) if value.respond_to?(:all) # check for an association filter_and_order_list(value) else value end else nil end end |
#errors ⇒ Object
42 43 44 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 42 def errors @_source.errors..to_hash.stringify_keys end |
#next ⇒ Object
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 %
25 26 27 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 25 def next @next ||= @_source.next.to_liquid end |
#previous ⇒ Object
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 %
38 39 40 |
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 38 def previous @previous ||= @_source.previous.to_liquid end |