sul-dlss/argo

View on GitHub
app/components/show/workflow_error_component.rb

Summary

Maintainability
A
0 mins
Test Coverage
B
81%
# frozen_string_literal: true

module Show
  class WorkflowErrorComponent < ApplicationComponent
    def initialize(document:)
      @document = document
    end

    attr_reader :document

    delegate :blacklight_config, :value_for_wf_error, to: :helpers

    def workflow_errors
      field_config = blacklight_config.show_fields_for([:show]).fetch(SolrDocument::FIELD_WORKFLOW_ERRORS)
      Blacklight::FieldPresenter.new(self, document, field_config).render
    end

    def render?
      document[SolrDocument::FIELD_WORKFLOW_ERRORS]
    end
  end
end