Sha256: 4d3aea945f770ec0e3bb17a571e8212341843c75351a47e19b7e2c8d690c55f5

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

module Locomotive
  module Liquid
    module Drops
      class Page < Base

        delegate :seo_title, :meta_keywords, :meta_description, :redirect_url, to: '_source'

        def title
          self._source.templatized? ? @context['entry']._label : self._source.title
        end

        def slug
          self._source.templatized? ? @context['entry']._slug.singularize : self._source.slug
        end

        def parent
          @parent ||= self._source.parent.to_liquid
        end

        def breadcrumbs
          @breadcrumbs ||= liquify(*self._source.ancestors_and_self)
        end

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

        def fullpath
          @fullpath ||= self._source.fullpath
        end

        def depth
          self._source.depth
        end

        def listed?
          self._source.listed?
        end

        def published?
          self._source.published?
        end

        def redirect?
          self._source.redirect?
        end

        def templatized?
          self._source.templatized?
        end

        def content_type
          if self._source.content_type
            ContentTypeProxyCollection.new(self._source.content_type)
          else
            nil
          end
        end

        def before_method(meth)
          self._source.editable_elements.where(slug: meth).try(:first).try(:content)
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_cms-2.1.4 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.1.3 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.1.2 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.1.1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.1.0 lib/locomotive/liquid/drops/page.rb