Sha256: 09f922ebf76d983e9d86119696b9f7c3f7bfc77d286612fc9a889ecee820da26

Contents?: true

Size: 885 Bytes

Versions: 7

Compression:

Stored size: 885 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
          @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

7 entries across 7 versions & 1 rubygems

Version Path
curation_concerns-1.7.4 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.3 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.2 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-2.0.0.rc1 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.1 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.0 app/presenters/curation_concerns/admin/workflow_role_presenter.rb
curation_concerns-1.7.0.beta1 app/presenters/curation_concerns/admin/workflow_role_presenter.rb