Sha256: d27edb6f15b64724fb45c70417c0d8bae2512843d1b99ac8d39ddd09b882ceea

Contents?: true

Size: 778 Bytes

Versions: 11

Compression:

Stored size: 778 Bytes

Contents

# frozen_string_literal: true
module GoodJob
  module ApplicationHelper
    def relative_time(timestamp)
      text = timestamp.future? ? "in #{time_ago_in_words(timestamp)}" : "#{time_ago_in_words(timestamp)} ago"
      tag.time(text, datetime: timestamp, title: timestamp)
    end

    def status_badge(status)
      classes = case status
                when :finished
                  "badge rounded-pill bg-success"
                when :queued, :scheduled, :retried
                  "badge rounded-pill bg-secondary"
                when :running
                  "badge rounded-pill bg-primary"
                when :discarded
                  "badge rounded-pill bg-danger"
                end

      content_tag :span, status.to_s, class: classes
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
good_job-2.13.2 engine/app/helpers/good_job/application_helper.rb
good_job-2.13.1 engine/app/helpers/good_job/application_helper.rb
good_job-2.13.0 engine/app/helpers/good_job/application_helper.rb
good_job-2.12.2 engine/app/helpers/good_job/application_helper.rb
good_job-2.12.1 engine/app/helpers/good_job/application_helper.rb
good_job-2.12.0 engine/app/helpers/good_job/application_helper.rb
good_job-2.11.3 engine/app/helpers/good_job/application_helper.rb
good_job-2.11.2 engine/app/helpers/good_job/application_helper.rb
good_job-2.11.1 engine/app/helpers/good_job/application_helper.rb
good_job-2.11.0 engine/app/helpers/good_job/application_helper.rb
good_job-2.10.0 engine/app/helpers/good_job/application_helper.rb