Sha256: 7a3fdb844caa5ec72a1688f20cd45db997c7147946bbf449049fe7b0994d3dbf

Contents?: true

Size: 993 Bytes

Versions: 20

Compression:

Stored size: 993 Bytes

Contents

module Hyrax
  module Admin
    # Displays a single workflow role
    class WorkflowRolePresenter
      def initialize(workflow_role)
        @workflow = workflow_role.workflow
        @role = workflow_role.role
        @admin_set_id = workflow.permission_template.admin_set_id
      end

      # @todo This is a hack; I don't want to include reference to the admin set;
      #       However based on the current UI, in which we list all workflows (spanning all admin sets) this is required.
      # @return [String] A meaningful label for the given WorkflowRole
      def label
        "#{admin_set_label(admin_set_id)} - #{role.name} (#{workflow.name})"
      end

      private

        attr_accessor :workflow, :role, :admin_set_id

        def admin_set_label(id)
          result = ActiveFedora::Base.search_by_id(id, fl: 'title_tesim')
          result['title_tesim'].first
        rescue ActiveFedora::ObjectNotFoundError
          "[AdminSet ID=#{id}]"
        end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hyrax-1.1.1 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.3 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.1.0 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.2 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.1 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.rc3 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.rc2 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.rc1 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.5 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.beta5 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.beta4 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.beta3 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.beta2 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-2.0.0.beta1 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.4 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.3 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.2 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.1 app/presenters/hyrax/admin/workflow_role_presenter.rb
hyrax-1.0.0.rc2 app/presenters/hyrax/admin/workflow_role_presenter.rb