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

#publication_stateObject



22
23
24
25
26
27
28
29
30
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 22

def publication_state
  if published_with_password_protection?
    'published_with_password_protection'
  elsif published?
    'published_without_password_protection'
  else
    'not_published'
  end
end

#published?Boolean

Returns:

  • (Boolean)


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

def published?
  published_revision.present?
end

#published_atObject



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

def published_at
  published? ? published_revision.published_at : nil
end

#published_untilObject



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

def published_until
  published? ? published_revision.published_until : nil
end

#published_with_password_protection?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'app/models/concerns/pageflow/entry_publication_states.rb', line 32

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