Sha256: 9f6e3eeacad41ef44893e58304af1515e9dca781a8c9638dd88ea40293d74ea2
Contents?: true
Size: 834 Bytes
Versions: 28
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true module PagesCore module PageModel module Status extend ActiveSupport::Concern module ClassMethods def status_labels { 0 => "Draft", 1 => "Reviewed", 2 => "Published", 3 => "Hidden", 4 => "Deleted" } end end # Return the status of the page as a string def status_label self.class.status_labels[status] end def flag_as_deleted! update(status: 4) end def draft? status.zero? end def reviewed? status == 1 end def published? status == 2 && !autopublish? end def hidden? status == 3 end def deleted? status == 4 end end end end
Version data entries
28 entries across 28 versions & 1 rubygems