Project

General

Profile

« Previous | Next » 

Revision d738d2c0

Added by Marek Hulán over 6 years ago

Fixes #19047 - unify date formats

This introduces two new helpers for printing date in absolute and
relative format. Helper for absolute accepts also a parameter to choose
between long and short variant. The long one includes the year. The date
also has a title so you see the other format after hovering mouse
cursor.

View differences:

app/helpers/hosts_helper.rb
end
def last_report_column(record)
time = record.last_report? ? _("%s ago") % time_ago_in_words(record.last_report): ""
time = record.last_report? ? date_time_relative_value(record.last_report) : ""
link_to_if_authorized(time,
hash_for_host_config_report_path(:host_id => record.to_param, :id => "last"),
last_report_tooltip(record))
......
def last_report_tooltip(record)
opts = { :rel => "twipsy" }
date = record.last_report.nil? ? '' : date_time_absolute_value(record.last_report) + ", "
if @last_report_ids[record.id]
opts["data-original-title"] = _("View last report details")
opts["data-original-title"] = date + _("view last report details")
else
opts.merge!(:disabled => true, :class => "disabled", :onclick => 'return false')
opts["data-original-title"] = _("Report Already Deleted") unless record.last_report.nil?
opts["data-original-title"] = date + _("report already deleted") unless record.last_report.nil?
end
opts
end

Also available in: Unified diff