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.0.1 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.rc3 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.rc2 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.rc1 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.5 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.beta5 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.beta4 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.beta3 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.beta2 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-2.0.0.beta1 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.4 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.3 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.2 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.1 app/presenters/hyrax/admin/workflow_roles_presenter.rb
hyrax-1.0.0.rc2 app/presenters/hyrax/admin/workflow_roles_presenter.rb