Sha256: d6ee6752211eb5181fb97d081bebfb9195b5d828abf85037cd561b011b92f1f7
Contents?: true
Size: 922 Bytes
Versions: 27
Compression:
Stored size: 922 Bytes
Contents
# frozen_string_literal: true module Export class PageResource include Alba::Resource attributes :id, :locale attributes(*PagesCore::Templates::TemplateConfiguration.all_blocks) attributes :created_at, :published_at, :pinned, :template, :redirect_to, :starts_at, :ends_at, :all_day has_many :attachments, resource: Export::AttachmentResource attribute :author_name do object&.author&.name end attribute :path do object.full_path || object.to_param end attribute :image do image_resource(object.page_images.where(primary: true).try(:first)) end attribute :images do object.page_images.map { |image| image_resource(image) } end attribute :status do object.status_label end private def image_resource(image) return nil unless image Export::PageImageResource.new(image) end end end
Version data entries
27 entries across 27 versions & 1 rubygems