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



34
35
36
37
38
39
40
41
42
43
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 34

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



45
46
47
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 45

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

#content_typeObject



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

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



59
60
61
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 59

def editable_elements
  @editable_elements_hash ||= build_editable_elements_hash
end

#original_slugObject



26
27
28
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 26

def original_slug
  @_source.slug
end

#original_titleObject



22
23
24
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 22

def original_title
  @_source.title
end

#parentObject



30
31
32
# File 'lib/locomotive/steam/liquid/drops/page.rb', line 30

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

#slugObject



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

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

#titleObject



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

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