Class: Locomotive::Steam::Liquid::Drops::Page

Inherits:
I18nBase
  • Object
show all
Defined in:
lib/locomotive/steam/liquid/drops/page.rb

Instance Method Summary collapse

Methods inherited from I18nBase

#context=, #initialize

Methods inherited from Base

#as_json, #id, #initialize

Constructor Details

This class inherits a constructor from Locomotive::Steam::Liquid::Drops::I18nBase

Instance Method Details



32
33
34
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 32

def breadcrumbs
  @breadcrumbs ||= liquify(*repository.ancestors_of(@_source))
end

#childrenObject



36
37
38
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 36

def children
  @children ||= liquify(*repository.children_of(@_source))
end

#content_typeObject



40
41
42
43
44
45
46
47
48
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 40

def content_type
  if @_source.templatized?
    # content_type can be either the slug of a content type or a content type
    content_type = content_type_repository.find(@_source.content_type_id)
    ContentEntryCollection.new(content_type)
  else
    nil
  end
end

#editable_elementsObject



50
51
52
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 50

def editable_elements
  @editable_elements_hash ||= build_editable_elements_hash
end

#original_slugObject



24
25
26
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 24

def original_slug
  @_source.slug
end

#original_titleObject



20
21
22
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 20

def original_title
  @_source.title
end

#parentObject



28
29
30
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 28

def parent
  @parent ||= repository.parent_of(@_source).to_liquid
end

#slugObject



15
16
17
18
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 15

def slug
  slug = @_source.templatized? ? @context['entry'].try(:_slug).try(:singularize) : nil
  slug || @_source.slug
end

#titleObject



10
11
12
13
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 10

def title
  title =  @_source.templatized? ? @context['entry'].try(:_label) : nil
  title || @_source.title
end