Sha256: 61e1236e98da871f4887ed2631932d6ee7b63b8405503425e3bb77a91bd4970a

Contents?: true

Size: 1.03 KB

Versions: 56

Compression:

Stored size: 1.03 KB

Contents

module Hyrax
  module Admin
    # Displays a list of users and their associated workflow roles
    class WorkflowRolesPresenter
      def users
        ::User.registered
      end

      def presenter_for(user)
        agent = user.sipity_agent
        return unless agent
        AgentPresenter.new(agent)
      end

      class AgentPresenter
        def initialize(agent)
          @agent = agent
        end

        def responsibilities_present?
          @agent.workflow_responsibilities.any?
        end

        def responsibilities
          @agent.workflow_responsibilities.each do |responsibility|
            yield ResponsibilityPresenter.new(responsibility)
          end
        end
      end

      class ResponsibilityPresenter
        def initialize(responsibility)
          @responsibility = responsibility
          @workflow_role_presenter = WorkflowRolePresenter.new(responsibility.workflow_role)
        end

        attr_accessor :responsibility

        delegate :label, to: :@workflow_role_presenter
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

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