Sha256: 48e6c8cf944c1885fb2bef9ee9e61c310012e46c876499f407e22a08f13581e6

Contents?: true

Size: 585 Bytes

Versions: 12

Compression:

Stored size: 585 Bytes

Contents

module Admin::JobsHelper

  def seconds_in_short(seconds)
    seconds = seconds.to_i
    minutes = seconds / 60
    hours   = seconds / (60 * 60)
    days    = seconds / (60 * 60 * 24)

    if days > 0
      return "#{days} d"
    elsif hours > 0
      return "#{hours} h"
    elsif minutes > 0
      return "#{minutes} m"
    else
      return "#{seconds} s"
    end
  end
  
  def time_ago_in_words_with_customization(time)
    if time
      "#{time_ago_in_words(time)} ago"
    else
      "n/a"
    end
  end
  
  def downloadable?(job)
    job.result.respond_to?(:join)
  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
genki-background_fu-1.0.8.2 generators/background/templates/scaffold/jobs_helper.rb
genki-background_fu-1.0.9.1 generators/background/templates/scaffold/jobs_helper.rb
genki-background_fu-1.0.9.2 generators/background/templates/scaffold/jobs_helper.rb
genki-background_fu-1.0.9 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.10 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.2 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.4 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.5 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.6 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.7 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.8 generators/background/templates/scaffold/jobs_helper.rb
ncr-background_fu-1.0.9 generators/background/templates/scaffold/jobs_helper.rb