Module: JobsDashboard::ApplicationHelper
- Defined in:
- app/helpers/jobs_dashboard/application_helper.rb
Instance Method Summary collapse
- #display_time(time) ⇒ Object
- #item_types_collection ⇒ Object
- #queues_collection ⇒ Object
- #status_label(status) ⇒ Object
- #statuses_collection ⇒ Object
Instance Method Details
#display_time(time) ⇒ Object
4 5 6 |
# File 'app/helpers/jobs_dashboard/application_helper.rb', line 4 def display_time time time.in_time_zone(DEFAULT_LOCAL_TIME_ZONE).strftime("%Y-%m-%d %I:%M:%S") end |
#item_types_collection ⇒ Object
17 18 19 |
# File 'app/helpers/jobs_dashboard/application_helper.rb', line 17 def item_types_collection JobLog.pluck(:item_type).compact.uniq.sort end |
#queues_collection ⇒ Object
27 28 29 |
# File 'app/helpers/jobs_dashboard/application_helper.rb', line 27 def queues_collection JobLog.pluck(:queue).compact.uniq.sort end |
#status_label(status) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/helpers/jobs_dashboard/application_helper.rb', line 8 def status_label status case status when 'complete' return 'success' when 'failed', 'interrupted' return 'error' end end |
#statuses_collection ⇒ Object
21 22 23 24 25 |
# File 'app/helpers/jobs_dashboard/application_helper.rb', line 21 def statuses_collection JobLog.statuses.keys.map do |key| [I18n.t("jobs_dashboard.statuses.#{key}"), key] end end |