Sha256: 51cabe3b1ee3e57619294179c56eda2186068b5cd213386f2554d82aea7129df

Contents?: true

Size: 1.37 KB

Versions: 16

Compression:

Stored size: 1.37 KB

Contents

module Locomotive
  module Liquid
    module Drops
      class Page < Base

        delegate :seo_title, :meta_keywords, :meta_description, :redirect_url, :handle, to: :@_source

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

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

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

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

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

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

        def depth
          @_source.depth
        end

        def listed?
          @_source.listed?
        end

        def published?
          @_source.published?
        end

        def redirect?
          @_source.redirect?
        end

        def templatized?
          @_source.templatized?
        end

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

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

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
locomotive_cms-2.5.6 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.5 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.4 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.3 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.2 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.0 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.4.1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.4.0 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.3.1 lib/locomotive/liquid/drops/page.rb
locomotive_cms-2.3.0 lib/locomotive/liquid/drops/page.rb