aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-03-16 21:40:56 +0100
committerGitHub <noreply@github.com>2023-03-16 15:40:56 -0500
commit272cf6a2a976d4e22cccdaea720f48861d9b200e (patch)
tree2a18a17ad4cd852383cd16797dba53ead04c0530 /modules
parent4b722068058931ab2734955a6b4120d5fa3d0830 (diff)
downloadgitea-272cf6a2a976d4e22cccdaea720f48861d9b200e.tar.gz
gitea-272cf6a2a976d4e22cccdaea720f48861d9b200e.zip
Make time tooltips interactive (#23526)
Fixes https://codeberg.org/forgejo/forgejo/issues/511 <img width="379" alt="Screenshot 2023-03-16 at 20 23 10" src="https://user-images.githubusercontent.com/115237/225731294-4c6e4f44-bdcc-4c8c-86e2-49f7c03b377d.png">
Diffstat (limited to 'modules')
-rw-r--r--modules/timeutil/since.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/timeutil/since.go b/modules/timeutil/since.go
index 295ba7c10e..53c22258c4 100644
--- a/modules/timeutil/since.go
+++ b/modules/timeutil/since.go
@@ -233,7 +233,7 @@ func TimeSince(then time.Time, lang translation.Locale) template.HTML {
}
func htmlTimeSince(then, now time.Time, lang translation.Locale) template.HTML {
- return template.HTML(fmt.Sprintf(`<span class="time-since tooltip" data-content="%s">%s</span>`,
+ return template.HTML(fmt.Sprintf(`<span class="time-since tooltip" data-content="%s" data-tooltip-interactive="true">%s</span>`,
then.In(setting.DefaultUILocation).Format(GetTimeFormat(lang.Language())),
timeSince(then, now, lang)))
}
@@ -244,7 +244,7 @@ func TimeSinceUnix(then TimeStamp, lang translation.Locale) template.HTML {
}
func htmlTimeSinceUnix(then, now TimeStamp, lang translation.Locale) template.HTML {
- return template.HTML(fmt.Sprintf(`<span class="time-since tooltip" data-content="%s">%s</span>`,
+ return template.HTML(fmt.Sprintf(`<span class="time-since tooltip" data-content="%s" data-tooltip-interactive="true">%s</span>`,
then.FormatInLocation(GetTimeFormat(lang.Language()), setting.DefaultUILocation),
timeSinceUnix(int64(then), int64(now), lang)))
}