Sha256: d7a989788b58ebf7e14b031695f0bb642377f92ffa4da21d496b4494f9d7eb5e

Contents?: true

Size: 651 Bytes

Versions: 3

Compression:

Stored size: 651 Bytes

Contents

module ContentState
  class Withdrawn < Base
    include Reloadable
    include Singleton
    
    def enter_hook(content)
      content[:published] = false
    end
    
    def change_published_state(content, boolean)
      return unless boolean
      content[:published] = true
      content.state = Published.instance
    end
    
    def set_published_at(content, new_time)
      content[:published_at] = new_time
      Trigger.remove(content, :trigger_method => 'publish!')
      return if new_time.nil? || new_time <= Time.now
      content.state = PublicationPending.instance
    end
    
    def withdrawn?
      true
    end
  end
end
      

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typo-4.0.2 app/models/content_state/withdrawn.rb
typo-4.0.1 app/models/content_state/withdrawn.rb
typo-4.0.3 app/models/content_state/withdrawn.rb