Module: MaintenanceTasks::ApplicationHelper Private

Defined in:
app/helpers/maintenance_tasks/application_helper.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Module for common view helpers.

Instance Method Summary collapse

Instance Method Details

#time_ago(datetime) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders a time element with the given datetime, worded as relative to the current time.

The ISO 8601 version of the datetime is shown on hover via a title attribute.

Parameters:

  • datetime (ActiveSupport::TimeWithZone)

    the time to be presented.

Returns:

  • (String)

    the HTML to render with the relative datetime in words.



16
17
18
19
20
# File 'app/helpers/maintenance_tasks/application_helper.rb', line 16

def time_ago(datetime)
  time_tag(datetime, title: datetime.utc.iso8601, class: "is-clickable") do
    time_ago_in_words(datetime) + " ago"
  end
end