Module: MissionControl::Jobs::DatesHelper

Included in:
ApplicationHelper
Defined in:
app/helpers/mission_control/jobs/dates_helper.rb

Instance Method Summary collapse

Instance Method Details

#bidirectional_time_distance_in_words_with_title(time) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'app/helpers/mission_control/jobs/dates_helper.rb', line 6

def bidirectional_time_distance_in_words_with_title(time)
  time_distance = if time.past?
    "#{time_ago_in_words_with_default_options(time)} ago"
  else
    "in #{time_ago_in_words_with_default_options(time)}"
  end

  tag.span time_distance, title: time.to_fs(:long)
end

#time_ago_in_words_with_default_options(time) ⇒ Object



16
17
18
# File 'app/helpers/mission_control/jobs/dates_helper.rb', line 16

def time_ago_in_words_with_default_options(time)
  time_ago_in_words(time, include_seconds: true, locale: :en)
end

#time_distance_in_words_with_title(time) ⇒ Object



2
3
4
# File 'app/helpers/mission_control/jobs/dates_helper.rb', line 2

def time_distance_in_words_with_title(time)
  tag.span time_ago_in_words_with_default_options(time), title: "Since #{time.to_fs(:long)}"
end