summaryrefslogtreecommitdiffstats
path: root/modules/timeutil
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-03-24 18:35:38 +0800
committerGitHub <noreply@github.com>2023-03-24 18:35:38 +0800
commit8d5fbeb7a290791dda8e8e8a1a0fd6824b76494f (patch)
tree4f7651105a8ad92d99de5a44daa943b70d79c38c /modules/timeutil
parent87f0f7e670c6c0e6aeab8c4458bfdb9d954eacec (diff)
downloadgitea-8d5fbeb7a290791dda8e8e8a1a0fd6824b76494f.tar.gz
gitea-8d5fbeb7a290791dda8e8e8a1a0fd6824b76494f.zip
Use data-tooltip-content for tippy tooltip (#23649)
Follow: * #23574 * Remove all ".tooltip[data-content=...]" Major changes: * Remove "tooltip" class, use "[data-tooltip-content=...]" instead of ".tooltip[data-content=...]" * Remove legacy `data-position`, it's dead code since last Fomantic Tooltip -> Tippy Tooltip refactoring * Rename reaction attribute from `data-content` to `data-reaction-content` * Add comments for some `data-content`: `{{/* used by the form */}}` * Remove empty "ui" class * Use "text color" for SVG icons (a few)
Diffstat (limited to 'modules/timeutil')
-rw-r--r--modules/timeutil/since.go4
-rw-r--r--modules/timeutil/since_test.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/modules/timeutil/since.go b/modules/timeutil/since.go
index 53c22258c4..daa5e15419 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" data-tooltip-interactive="true">%s</span>`,
+ return template.HTML(fmt.Sprintf(`<span class="time-since" data-tooltip-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" data-tooltip-interactive="true">%s</span>`,
+ return template.HTML(fmt.Sprintf(`<span class="time-since" data-tooltip-content="%s" data-tooltip-interactive="true">%s</span>`,
then.FormatInLocation(GetTimeFormat(lang.Language()), setting.DefaultUILocation),
timeSinceUnix(int64(then), int64(now), lang)))
}
diff --git a/modules/timeutil/since_test.go b/modules/timeutil/since_test.go
index 2e1dde00f6..9a037c7bd0 100644
--- a/modules/timeutil/since_test.go
+++ b/modules/timeutil/since_test.go
@@ -119,7 +119,7 @@ func TestHtmlTimeSince(t *testing.T) {
// test that `diff` yields a result containing `expected`
test := func(expected string, diff time.Duration) {
actual := htmlTimeSince(BaseDate, BaseDate.Add(diff), translation.NewLocale("en-US"))
- assert.Contains(t, actual, `data-content="Sat Jan 1 00:00:00 UTC 2000"`)
+ assert.Contains(t, actual, `data-tooltip-content="Sat Jan 1 00:00:00 UTC 2000"`)
assert.Contains(t, actual, expected)
}
test("1 second", time.Second)