Class: Hyrax::FixityStatusPresenter

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper
Defined in:
app/presenters/hyrax/fixity_status_presenter.rb

Overview

Creates fixity status messages to display to user, for a fileset. Determines status by looking up existing recorded ChecksumAuditLog objects, does not actually do a check itself.

See FileSetFixityCheckService and ChecksumAuditLog for actually performing checks and recording as ChecksumAuditLog objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_set_id) ⇒ FixityStatusPresenter

Note this takes a file_set_id NOT a FileSet, easy use from either solr or AF object.


16
17
18
# File 'app/presenters/hyrax/fixity_status_presenter.rb', line 16

def initialize(file_set_id)
  @file_set_id = file_set_id
end

Instance Attribute Details

#file_set_idObject (readonly)

Returns the value of attribute file_set_id


13
14
15
# File 'app/presenters/hyrax/fixity_status_presenter.rb', line 13

def file_set_id
  @file_set_id
end

Instance Method Details

#render_file_set_statusObject

Returns a html_safe string communicating fixity status checks, possibly on multiple files/versions.


22
23
24
25
26
27
28
29
30
31
# File 'app/presenters/hyrax/fixity_status_presenter.rb', line 22

def render_file_set_status
  @file_set_status ||=
    if relevant_log_records.empty?
      "Fixity checks have not yet been run on this object"
    elsif failing_checks.empty?
      ("span", "passed", class: "label label-success") + ' ' + render_existing_check_summary
    else
      ("span", "FAIL", class: "label label-danger") + ' ' + render_existing_check_summary + render_failed_compact
    end
end