Class: Locomotive::Liquid::Drops::ContentEntry

Inherits:
Base
  • Object
show all
Defined in:
lib/locomotive/liquid/drops/content_entry.rb

Instance Method Summary collapse

Methods inherited from Base

#id, #initialize, liquify

Constructor Details

This class inherits a constructor from Locomotive::Liquid::Drops::Base

Instance Method Details

#_idObject



8
9
10
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 8

def _id
  @_source._id.to_s
end

#_labelObject



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

#errorsObject



42
43
44
# File 'lib/locomotive/liquid/drops/content_entry.rb', line 42

def errors
  @_source.errors.messages.to_hash.stringify_keys
end

#nextObject

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

#previousObject

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