Sha256: fd561188a49d0315b193f7846ee2646e9ba76e9198f66aeec13085de34c730d0
Contents?: true
Size: 775 Bytes
Versions: 3
Compression:
Stored size: 775 Bytes
Contents
module ContentState class New < Base include Reloadable include Singleton def enter_hook(content) super content[:published] = false content[:published_at] = nil end def before_save(content) super content.state = Draft.instance end def change_published_state(content, boolean) content[:published] = boolean if boolean content.state = JustPublished.instance end end def set_published_at(content, new_time) content[:published_at] = new_time return if new_time.nil? if new_time <= Time.now content.state = JustPublished.instance else content.state = PublicationPending.instance end end def draft? true end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
typo-4.0.2 | app/models/content_state/new.rb |
typo-4.0.1 | app/models/content_state/new.rb |
typo-4.0.3 | app/models/content_state/new.rb |