Class: Archangel::Page

Inherits:
ApplicationRecord show all
Extended by:
ActsAsTree::TreeView
Defined in:
app/models/archangel/page.rb

Overview

Page model

Instance Method Summary collapse

Instance Method Details

#published?Boolean

Check if Page is published. Published in the past, present and future. Future publication date is also considered published.

Returns:

  • (Boolean)

    if published



57
58
59
# File 'app/models/archangel/page.rb', line 57

def published?
  published_at.present?
end

#statusString

Return string of publication status.

Returns:

  • (String)

    publication status



66
67
68
69
70
71
72
73
74
75
76
# File 'app/models/archangel/page.rb', line 66

def status
  if published?
    if published_at > Time.now
      "future-published"
    else
      "published"
    end
  else
    "unpublished"
  end
end

#to_liquidObject

Liquid object for Page

Returns:

  • (Object)

    the Liquid object



83
84
85
# File 'app/models/archangel/page.rb', line 83

def to_liquid
  Archangel::Liquid::Drops::PageDrop.new(self)
end