Module: JobsHelper

Defined in:
frontend/app/helpers/jobs_helper.rb

Instance Method Summary collapse

Instance Method Details

#badge_class_for_status(status) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'frontend/app/helpers/jobs_helper.rb', line 14

def badge_class_for_status(status)
  if status === "running"
    "badge badge-info"
  elsif status === "completed"
    "text-success"
  elsif status === "queued"
    "badge badge-warning"
  elsif status === "failed"
    "badge badge-important"
  elsif status === "canceled"
    "text-error"
  else
    ""
  end
end

#file_label(job_type) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'frontend/app/helpers/jobs_helper.rb', line 2

def file_label(job_type)
  if job_type == "print_to_pdf_job"
    I18n.t("actions.download_pdf")
  elsif job_type == "report_job"
    I18n.t("actions.download_report")
  elsif job_type == "bulk_import_job"
    I18n.t("actions.download_bulk_import_report")
  else
    "File"
  end
end

#is_global_record?(json_model) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'frontend/app/helpers/jobs_helper.rb', line 30

def is_global_record?(json_model)
  json_model.match?(/agent|location|subject/)
end


34
35
36
37
38
39
# File 'frontend/app/helpers/jobs_helper.rb', line 34

def link_for_resource(uri)
  id = JSONModel(:resource).id_for(uri)
  URI.join(
    AppConfig[:frontend_proxy_url], File.join('resources', id.to_s, "edit#tree::resource_#{id}")
  ).to_s
end