Sha256: 0c42f86c365c838c9fea6941f26f4cb97b7fb891453c0dd0b46ddf5b4a6a5eba
Contents?: true
Size: 935 Bytes
Versions: 1
Compression:
Stored size: 935 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, :skip_index 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/resources/export/page_resource.rb |