Sha256: e4322add408a2c44c4e80f618bf8f43cb17eb005a60e1886a03485450765cfa1

Contents?: true

Size: 941 Bytes

Versions: 35

Compression:

Stored size: 941 Bytes

Contents

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?
      return false if state.nil?

      state == Vocab::FedoraResourceStatus.inactive
    end

    def to_sipity_entity
      raise "Can't create an entity until the model has been persisted" unless persisted?
      @sipity_entity ||= Sipity::Entity.find_by(proxy_for_global_id: to_global_id.to_s)
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.5 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.4 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.3 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.2 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.1 app/models/concerns/hyrax/suppressible.rb
hyrax-2.9.0 app/models/concerns/hyrax/suppressible.rb
hyrax-2.8.0 app/models/concerns/hyrax/suppressible.rb
hyrax-2.7.2 app/models/concerns/hyrax/suppressible.rb
hyrax-2.7.1 app/models/concerns/hyrax/suppressible.rb
hyrax-2.7.0 app/models/concerns/hyrax/suppressible.rb
hyrax-2.6.0 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.rc1 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.beta3 app/models/concerns/hyrax/suppressible.rb
hyrax-2.5.1 app/models/concerns/hyrax/suppressible.rb
hyrax-2.5.0 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.beta2 app/models/concerns/hyrax/suppressible.rb
hyrax-2.4.1 app/models/concerns/hyrax/suppressible.rb
hyrax-3.0.0.pre.beta1 app/models/concerns/hyrax/suppressible.rb
hyrax-2.4.0 app/models/concerns/hyrax/suppressible.rb