Sha256: 88d4ec3a51869c8d0e91fc69defddc18ca8c0b012bf801453688ac598fb5b334

Contents?: true

Size: 1.29 KB

Versions: 11

Compression:

Stored size: 1.29 KB

Contents

module Locomotive
  module API
    module Entities

      class PageEntity < BaseEntity

        expose  :title, :parent_id, :position,
                :handle, :depth, :response_type,
                :listed, :published, :translated_in, :cache_enabled

        # Path
        expose :slug, :fullpath

        expose :localized_fullpaths do |page, options|
          (options[:site].try(:locales) || []).inject({}) do |hash, locale|
            hash.merge(locale => options[:site].localized_page_fullpath(page, locale))
          end
        end

        # Redirection
        expose :redirect, :redirect_url, :redirect_type

        # Templatized page (related to a content type)
        expose :templatized, :templatized_from_parent

        expose :content_type do |page, _|
          page.content_type.try(:slug)
        end

        # Layout / Template
        expose :is_layout, :allow_layout

        expose :template do |page, _|
          page.raw_template
        end

        # Editable elements
        expose :editable_elements, using: EditableElementEntity

        # SEO
        expose :seo_title, :meta_keywords, :meta_description

      end

      class FullpathPageEntity < BaseEntity

        expose :fullpath

        unexpose :created_at
        unexpose :updated_at

      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
locomotivecms-3.1.0.rc2 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.1.0.rc1 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.1 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc7 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc6 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc5 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc4 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc3 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc2 app/api/locomotive/api/entities/page_entity.rb
locomotivecms-3.0.0.rc1 app/api/locomotive/api/entities/page_entity.rb