Sha256: 623a6bfc57fdec498a0f21479bccbab3944f942b5ce6dc36fba415b9bc2e5b0f

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true
module Hyrax
  # A work should be able to be filtered out of search results if it's inactive
  module Suppressible
    extend ActiveSupport::Concern

    included do
      # This holds the workflow state
      property :state, predicate: Vocab::FedoraResourceStatus.objState, multiple: false
    end

    ##
    # Used to restrict visibility on search results for a work that is inactive. If the state is not set, the
    # default behavior is to consider the work not to be suppressed.
    #
    # Override this method if you have some criteria by which records should not display in the search results.
    def suppressed?
      Hyrax::ResourceStatus.new(resource: self).inactive?
    end

    ##
    # @deprecated Use `Sipity::Entity(entity)` instead.
    def to_sipity_entity
      Deprecation.warn "Use `Sipity::Entity(entity)` instead."
      raise "Can't create an entity until the model has been persisted" unless persisted?
      @sipity_entity ||= Sipity::Entity(to_global_id)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyrax-3.0.2 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.1 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.rc4 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.rc3 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.rc2 app/models/concerns/hyrax/suppressible.rb