Sha256: 11309270003da96e2107e9919c397bce6ca2c02189231f6d6030290d02be2211

Contents?: true

Size: 984 Bytes

Versions: 6

Compression:

Stored size: 984 Bytes

Contents

module CurationConcerns
  module Admin
    class WorkflowRolePresenter
      def users
        ::User.all
      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
          @wf_role = responsibility.workflow_role
        end

        attr_accessor :responsibility

        def label
          "#{@wf_role.workflow.name} - #{@wf_role.role.name}"
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.7 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-2.0.0 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-2.0.0.rc2 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.6 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.5 app/presenters/curation_concerns/admin/workflow_role_presenter.rb