aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/job_status_icon_helper.rb
blob: 697b4d10c4244f8a740c4abad4bcc37d775d506c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module JobStatusIconHelper

  def job_status_title(object)
    status = object.status
    name = object.name
    object_name = object.class.model_name.human.capitalize

    title = ''
    if %w{ aborted canceled }.include?(status)
      title += '<span class="name aborted"><i class="fa fa-times"></i>'
    elsif %w{ started scheduled }.include?(status)
      title += "<span class=\"name processed progress\" title=\"#{I18n.t('job_status.title.processed')}\"><i class=\"fa fa-clock-o\"></i>"
    elsif %w{ terminated }.include?(status)
      title += '<span class="name terminated"><i class="fa fa-check"></i>'
    end

    title += "#{object_name} #{truncate(name, length: 20)}</span>"

    title.html_safe
  end

  def job_status_short_title(object)
    name = object.name
    object_name = object.class.model_name.human.capitalize

    "#{object_name} #{truncate(name, length: 20)}".html_safe
  end

end