Adjust `time_tooltip` method to show shorter time format

This commit is contained in:
Andreas Nedbal 2024-03-02 21:36:29 +01:00 committed by Andreas Nedbal
parent e8f661f555
commit f4095c42ec
2 changed files with 41 additions and 2 deletions

View File

@ -73,8 +73,7 @@ module BootstrapHelper
end
def time_tooltip(subject, placement = "bottom")
tooltip time_ago_in_words(subject.created_at), localize(subject.created_at), placement
end
tooltip time_ago_in_words(subject.created_at, scope: "datetime.distance_in_words.short"), localize(subject.created_at, format: :long), placement
end
##

View File

@ -42,3 +42,43 @@ en:
days: "days"
weeks: "weeks"
months: "months"
datetime:
distance_in_words:
short:
about_x_hours:
one: "1h"
other: "%{count}h"
about_x_months:
one: "1mo"
other: "%{count}mo"
about_x_years:
one: "1y"
other: "%{count}y"
almost_x_years:
one: "1y"
other: "%{count}y"
half_a_minute: 1m
less_than_x_seconds:
one: "1s"
other: "%{count}s"
less_than_x_minutes:
one: "1m"
other: "%{count}m"
over_x_years:
one: "1y"
other: "%{count}y"
x_seconds:
one: "1s"
other: "%{count}s"
x_minutes:
one: "1m"
other: "%{count}m"
x_days:
one: "1d"
other: "%{count}d"
x_months:
one: "1mo"
other: "%{count}mo"
x_years:
one: "1y"
other: "%{count}y"