module OscMacheteRails::Helper

Public Instance Methods

job_status_label(job, tag = :span)
Alias for: status_label
status_label(job, tag = :span) click to toggle source
# File lib/osc_machete_rails/helper.rb, line 3
def status_label(job, tag = :span)
  job ||= OpenStruct.new status: OSC::Machete::Status.not_submitted
  text = job.status.to_s

  label_class = 'label-default'
  if job.failed?
    label_class = 'label-danger'
  elsif job.passed?
    label_class = 'label-success'
    text = "Completed"
  elsif job.active?
    label_class = 'label-primary'
  end

  content_tag tag, class: %I(status-label label #{label_class}) do
    text
  end
end
Also aliased as: job_status_label