Module: Pageflow::EntryPublicationStates

Extended by:
ActiveSupport::Concern
Included in:
Entry
Defined in:
app/models/concerns/pageflow/entry_publication_states.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#last_published_with_noindex?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 53

def last_published_with_noindex?
  !!revisions.publications.first&.noindex
end

#publication_stateObject



25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 25

def publication_state
  if published_with_password_protection?
    'published_with_password_protection'
  elsif published? && published_revision.noindex?
    'published_with_noindex'
  elsif published?
    'published_without_password_protection'
  else
    'not_published'
  end
end

#published?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 41

def published?
  published_revision.present?
end

#published_atObject



45
46
47
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 45

def published_at
  published? ? published_revision.published_at : nil
end

#published_untilObject



49
50
51
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 49

def published_until
  published? ? published_revision.published_until : nil
end

#published_with_password_protection?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 37

def published_with_password_protection?
  published? && published_revision.password_protected?
end