Sha256: acada70e0101d7dc4f724ab7c481b7dfd50d44963e92dc6b934d877ec62f29f6
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
module ContentState class PublicationPending < Base include Reloadable include Singleton class << self def derivable_from(content) !content.published && content.published_at || content.new_record? && content.published_at && content.published_at > Time.now end end def serialize_on(content) content[:published] = false if content.new_record? true end def change_published_state(content, boolean) content[:published] = boolean if content.published && content.published_at <= Time.now content.state = JustPublished.instance end end def set_published_at(content, new_time) content[:published_at] = new_time Trigger.remove(content, :trigger_method => 'publish!') if new_time.nil? content.state = Draft.instance elsif new_time <= Time.now content.state = JustPublished.instance end end def publication_pending? true end def post_trigger(content) Trigger.post_action(content.published_at, content, 'publish!') end end end
Version data entries
6 entries across 6 versions & 1 rubygems