Sha256: 08f2462f5301d196a4ce5ada790b71de8fc8a625b5f904a65b175407bded95cb

Contents?: true

Size: 1009 Bytes

Versions: 13

Compression:

Stored size: 1009 Bytes

Contents

module Locomotive
  module API
    module Entities

      class ContentTypeEntity < BaseEntity

        expose  :name, :slug, :description, :label_field_name, :order_direction,
                :public_submission_enabled,
                :public_submission_accounts,
                :public_submission_title_template,
                :entry_template, :display_settings, :filter_fields

        expose :fields, using: ContentTypeFieldEntity do |content_type, _|
          content_type.ordered_entries_custom_fields || []
        end

        expose :order_by do |content_type, _|
          content_type.order_by_attribute
        end

        expose :group_by do |content_type, _|
          content_type.group_by_field.try(:name)
        end

        expose :public_submission_account_emails do |content_type, _|
          ([*content_type.public_submission_accounts]).map do |_id|
            Locomotive::Account.where(_id: _id).first.try(:email)
          end.compact
        end

      end

    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms-4.0.0.alpha3 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.4.1 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-4.0.0.alpha2 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-4.0.0.alpha1 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.4.0 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.3.0 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.3.0.rc3 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.3.0.rc2 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.2.1 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.3.0.rc1 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.2.0 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.2.0.rc2 app/api/locomotive/api/entities/content_type_entity.rb
locomotivecms-3.2.0.rc1 app/api/locomotive/api/entities/content_type_entity.rb