Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions app/models/alchemy/page_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,6 @@ class << self

before_destroy :delete_elements

# Determines if this version is public
#
# Takes the two timestamps +public_on+ and +public_until+
# and returns true if the time given (+Time.current+ per default)
# is in this timespan.
#
# @param time [DateTime] (Time.current)
# @returns Boolean
def public?(time = Current.preview_time)
already_public_for?(time) && still_public_for?(time)
end

# Determines if this version is already public for given time
# @param time [DateTime] (Current.preview_time)
# @returns Boolean
def already_public_for?(time = Current.preview_time)
!public_on.nil? && public_on <= time
end

# Determines if this version is still public for given time
# @param time [DateTime] (Current.preview_time)
# @returns Boolean
def still_public_for?(time = Current.preview_time)
public_until.nil? || public_until >= time
end

def element_repository
ElementsRepository.new(elements)
end
Expand Down
Loading