Sha256: 6e2a1d343ac20ea1706b30fd65f5a96fcb65a608468f30225c5529250c1dc5c9

Contents?: true

Size: 719 Bytes

Versions: 19

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Hyrax
  module Workflow
    ##
    # Decorates objects with attributes with their workflow state.
    class ObjectInWorkflowDecorator < Hyrax::ModelDecorator
      delegate_all

      ##
      # @!attribute [w] workflow
      #   @return [Sipity::Workflow]
      # @!attribute [w] workflow_state
      #   @return [Sipity::WorkflowState]
      attr_writer :workflow, :workflow_state

      ##
      # @return [Boolean]
      def published?
        Hyrax::Admin::WorkflowsController.deposited_workflow_state_name ==
          workflow_state
      end

      ##
      # @return [String]
      def workflow_state
        @workflow_state&.name || 'unknown'
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-5.0.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-5.0.0.rc3 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-5.0.0.rc2 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-5.0.0.rc1 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.6.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0.rc3 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0.rc2 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0.rc1 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.5.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0.beta2 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.4.2 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-4.0.0.beta1 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.4.1 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.4.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.3.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.2.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb
hyrax-3.1.0 app/services/hyrax/workflow/object_in_workflow_decorator.rb