Sha256: 31be55df427d8d76403965c8632ab55dc0aa9e28ab2c139d0e607f151e57856d

Contents?: true

Size: 981 Bytes

Versions: 36

Compression:

Stored size: 981 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
        @source_id = workflow.permission_template.source_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(source_id)} - #{role.name} (#{workflow.name})"
      end

      private

        attr_accessor :workflow, :role, :source_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

36 entries across 36 versions & 1 rubygems

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