class GovukPublishingComponents::Presenters::Page

Attributes

local_assigns[R]

Public Class Methods

new(local_assigns) click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 6
def initialize(local_assigns)
  @local_assigns = local_assigns
end

Public Instance Methods

attachments() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 54
def attachments
  content_item.dig("details", "attachments")
end
base_path() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 50
def base_path
  content_item["base_path"]
end
body() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 18
def body
  local_assigns[:body] || content_item.dig("details", "body")
end
canonical_url() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 14
def canonical_url
  local_assigns[:canonical_url] || (Plek.current.website_root + content_item["base_path"])
end
content_item() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 58
def content_item
  local_assigns[:content_item]
end
description() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 26
def description
  local_assigns[:description] || content_item["description"]
end
document_type() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 46
def document_type
  content_item["document_type"]
end
has_image?() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 30
def has_image?
  content_item.dig("details", "image").present?
end
image_alt_text() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 38
def image_alt_text
  content_item.dig("details", "image", "alt_text")
end
image_placeholders() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 42
def image_placeholders
  local_assigns[:image_placeholders]
end
image_url() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 34
def image_url
  content_item.dig("details", "image", "high_resolution_url") || content_item.dig("details", "image", "url")
end
logo_url() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 62
def logo_url
  local_assigns[:logo_url]
end
requested_path() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 66
def requested_path
  local_assigns[:request_path]
end
schema() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 10
def schema
  local_assigns.fetch(:schema)
end
title() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 22
def title
  local_assigns[:title] || content_item["title"]
end
withdrawn?() click to toggle source
# File lib/govuk_publishing_components/presenters/machine_readable/page.rb, line 70
def withdrawn?
  content_item["withdrawn_notice"].present?
end