Sha256: 48561d3caaf80b4ddb554cd6e2c33ee99b00eab50206a9d513de3f885c60dc90

Contents?: true

Size: 1003 Bytes

Versions: 5

Compression:

Stored size: 1003 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

    def render_icon(name)
      # workaround to render svg icons without all of the log messages
      partial = lookup_context.find_template("good_job/shared/icons/#{name}", [], true)
      partial.render(self, {})
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
good_job-2.14.4 engine/app/helpers/good_job/application_helper.rb
good_job-2.14.3 engine/app/helpers/good_job/application_helper.rb
good_job-2.14.2 engine/app/helpers/good_job/application_helper.rb
good_job-2.14.1 engine/app/helpers/good_job/application_helper.rb
good_job-2.14.0 engine/app/helpers/good_job/application_helper.rb