Remove the time-since
class (#29826)
It serves no purpose. --------- Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
3979970938
commit
3f1e4896b6
@ -13,6 +13,8 @@ import (
|
|||||||
|
|
||||||
// DateTime renders an absolute time HTML element by datetime.
|
// DateTime renders an absolute time HTML element by datetime.
|
||||||
func DateTime(format string, datetime any, extraAttrs ...string) template.HTML {
|
func DateTime(format string, datetime any, extraAttrs ...string) template.HTML {
|
||||||
|
// TODO: remove the extraAttrs argument, it's not used in any call to DateTime
|
||||||
|
|
||||||
if p, ok := datetime.(*time.Time); ok {
|
if p, ok := datetime.(*time.Time); ok {
|
||||||
datetime = *p
|
datetime = *p
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ func timeSinceUnix(then, now time.Time, _ translation.Locale) template.HTML {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip
|
// declare data-tooltip-content attribute to switch from "title" tooltip to "tippy" tooltip
|
||||||
htm := fmt.Sprintf(`<relative-time class="time-since" prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`,
|
htm := fmt.Sprintf(`<relative-time prefix="" %s datetime="%s" data-tooltip-content data-tooltip-interactive="true">%s</relative-time>`,
|
||||||
attrs, then.Format(time.RFC3339), friendlyText)
|
attrs, then.Format(time.RFC3339), friendlyText)
|
||||||
return template.HTML(htm)
|
return template.HTML(htm)
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ func timeSinceUnix(then, now time.Time, _ translation.Locale) template.HTML {
|
|||||||
// TimeSince renders relative time HTML given a time.Time
|
// TimeSince renders relative time HTML given a time.Time
|
||||||
func TimeSince(then time.Time, lang translation.Locale) template.HTML {
|
func TimeSince(then time.Time, lang translation.Locale) template.HTML {
|
||||||
if setting.UI.PreferredTimestampTense == "absolute" {
|
if setting.UI.PreferredTimestampTense == "absolute" {
|
||||||
return DateTime("full", then, `class="time-since"`)
|
return DateTime("full", then)
|
||||||
}
|
}
|
||||||
return timeSinceUnix(then, time.Now(), lang)
|
return timeSinceUnix(then, time.Now(), lang)
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func testViewRepo(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// convert "2017-06-14 21:54:21 +0800" to "Wed, 14 Jun 2017 13:54:21 UTC"
|
// convert "2017-06-14 21:54:21 +0800" to "Wed, 14 Jun 2017 13:54:21 UTC"
|
||||||
htmlTimeString, _ := s.Find("relative-time.time-since").Attr("datetime")
|
htmlTimeString, _ := s.Find("relative-time").Attr("datetime")
|
||||||
htmlTime, _ := time.Parse(time.RFC3339, htmlTimeString)
|
htmlTime, _ := time.Parse(time.RFC3339, htmlTimeString)
|
||||||
f.commitTime = htmlTime.In(time.Local).Format(time.RFC1123)
|
f.commitTime = htmlTime.In(time.Local).Format(time.RFC1123)
|
||||||
items = append(items, f)
|
items = append(items, f)
|
||||||
|
@ -248,7 +248,7 @@ export default {
|
|||||||
{{ commit.committer_or_author_name }}
|
{{ commit.committer_or_author_name }}
|
||||||
<span class="text right">
|
<span class="text right">
|
||||||
<!-- TODO: make this respect the PreferredTimestampTense setting -->
|
<!-- TODO: make this respect the PreferredTimestampTense setting -->
|
||||||
<relative-time class="time-since" prefix="" :datetime="commit.time" data-tooltip-content data-tooltip-interactive="true">{{ commit.time }}</relative-time>
|
<relative-time prefix="" :datetime="commit.time" data-tooltip-content data-tooltip-interactive="true">{{ commit.time }}</relative-time>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user