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
35
36
37
38
39
40
41
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 32

def breadcrumbs
  return @breadcrumbs if @breadcrumbs

  # remove the last one and replace it by the current instance
  # which may have a valid reference to a content entry (if templatized)
  pages = liquify(*repository.ancestors_of(@_source))
  pages.pop

  @breadcrumbs = pages + [self]
end

#childrenObject



43
44
45
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 43

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

#content_typeObject



47
48
49
50
51
52
53
54
55
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 47

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



57
58
59
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 57

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