diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index abf22526..f15de800 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -107,7 +107,10 @@ func (p *Pages) funcMap() template.FuncMap { }, "timeFmt": humanize.Time, "longTimeFmt": func(t time.Time) string { - return t.Format("2006-01-02 * 3:04 PM") + return t.Format("Jan 2, 2006, 3:04 PM MST") + }, + "iso8601Fmt": func(t time.Time) string { + return t.Format("2006-01-02T15:04:05-07:00") }, "commaFmt": humanize.Comma, "shortTimeFmt": func(t time.Time) string { diff --git a/appview/pages/templates/knot.html b/appview/pages/templates/knot.html index 46c62313..37782ed3 100644 --- a/appview/pages/templates/knot.html +++ b/appview/pages/templates/knot.html @@ -26,11 +26,11 @@
opened
-
{{ .Registration.Created | timeFmt }}
+
{{ template "repo/fragments/time" .Registration.Created }}
{{ if .Registration.Registered }}
registered
-
{{ .Registration.Registered | timeFmt }}
+
{{ template "repo/fragments/time" .Registration.Registered }}
{{ else }}
status
diff --git a/appview/pages/templates/knots.html b/appview/pages/templates/knots.html index 3a21bf98..2509555b 100644 --- a/appview/pages/templates/knots.html +++ b/appview/pages/templates/knots.html @@ -44,7 +44,7 @@

owned by {{ .ByDid }}

-

registered {{ .Registered | timeFmt }}

+

registered {{ template "repo/fragments/time" .Registered }}

{{ end }} @@ -70,7 +70,7 @@

opened by {{ .ByDid }}

-

created {{ .Created | timeFmt }}

+

created {{ template "repo/fragments/time" .Created }}

{{ end }} diff --git a/appview/pages/templates/repo/commit.html b/appview/pages/templates/repo/commit.html index d1f29969..4cfc7a5f 100644 --- a/appview/pages/templates/repo/commit.html +++ b/appview/pages/templates/repo/commit.html @@ -34,7 +34,7 @@ {{ $commit.Author.Name }} {{ end }} - {{ timeFmt $commit.Author.When }} + {{ template "repo/fragments/time" $commit.Author.When }}

diff --git a/appview/pages/templates/repo/compare/new.html b/appview/pages/templates/repo/compare/new.html index 5055aab6..8270be63 100644 --- a/appview/pages/templates/repo/compare/new.html +++ b/appview/pages/templates/repo/compare/new.html @@ -19,7 +19,7 @@
{{ $br.Name }} - + {{ template "repo/fragments/time" $br.Commit.Committer.When }}
{{ end }} diff --git a/appview/pages/templates/repo/empty.html b/appview/pages/templates/repo/empty.html index 639df80b..5cd7e5ca 100644 --- a/appview/pages/templates/repo/empty.html +++ b/appview/pages/templates/repo/empty.html @@ -17,7 +17,7 @@
{{ $br.Name }} - + {{ template "repo/fragments/time" $br.Commit.Committer.When }}
{{ end }} diff --git a/appview/pages/templates/repo/fragments/artifact.html b/appview/pages/templates/repo/fragments/artifact.html index bf8849dc..b4d98b7c 100644 --- a/appview/pages/templates/repo/fragments/artifact.html +++ b/appview/pages/templates/repo/fragments/artifact.html @@ -10,8 +10,8 @@
- - {{ shortTimeFmt .Artifact.CreatedAt }} + + {{ template "repo/fragments/shortTime" .Artifact.CreatedAt }} diff --git a/appview/pages/templates/repo/fragments/time.html b/appview/pages/templates/repo/fragments/time.html new file mode 100644 index 00000000..7934f817 --- /dev/null +++ b/appview/pages/templates/repo/fragments/time.html @@ -0,0 +1,15 @@ +{{ define "repo/fragments/timeWrapper" }} + +{{ end }} + +{{ define "repo/fragments/time" }} +{{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (. | timeFmt)) }} +{{ end }} + +{{ define "repo/fragments/shortTime" }} +{{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (. | shortTimeFmt)) }} +{{ end }} + +{{ define "repo/fragments/shortTimeAgo" }} +{{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (print (. | shortTimeFmt) " ago")) }} +{{ end }} \ No newline at end of file diff --git a/appview/pages/templates/repo/index.html b/appview/pages/templates/repo/index.html index c0392967..55021e34 100644 --- a/appview/pages/templates/repo/index.html +++ b/appview/pages/templates/repo/index.html @@ -149,9 +149,7 @@ {{ if .LastCommit }} - + {{ template "repo/fragments/time" .LastCommit.When }} {{ end }}
@@ -172,9 +170,7 @@ {{ if .LastCommit }} - + {{ template "repo/fragments/time" .LastCommit.When }} {{ end }} @@ -273,7 +269,7 @@ >
- {{ timeFmt .Committer.When }} + {{ template "repo/fragments/time" .Committer.When }} {{ $tagsForCommit := index $.TagMap .Hash.String }} @@ -320,7 +316,7 @@ {{ if .Commit }} - + {{ template "repo/fragments/time" .Commit.Committer.When }} {{ end }} {{ if .IsDefault }} @@ -366,7 +362,7 @@
{{ with .Tag }} - + {{ template "repo/fragments/time" .Tagger.When }} {{ end }} {{ if eq $idx 0 }} {{ with .Tag }}{{ end }} diff --git a/appview/pages/templates/repo/issues/fragments/editIssueComment.html b/appview/pages/templates/repo/issues/fragments/editIssueComment.html index ce6aac33..64082f42 100644 --- a/appview/pages/templates/repo/issues/fragments/editIssueComment.html +++ b/appview/pages/templates/repo/issues/fragments/editIssueComment.html @@ -19,7 +19,7 @@ href="#{{ .CommentId }}" class="text-gray-500 hover:text-gray-500 hover:underline no-underline" id="{{ .CommentId }}"> - {{ .Created | timeFmt }} + {{ template "repo/fragments/time" .Created }}
diff --git a/appview/pages/templates/repo/issues/issues.html b/appview/pages/templates/repo/issues/issues.html index 8087888d..ef3e194d 100644 --- a/appview/pages/templates/repo/issues/issues.html +++ b/appview/pages/templates/repo/issues/issues.html @@ -70,9 +70,7 @@ - + {{ template "repo/fragments/time" .Created }} diff --git a/appview/pages/templates/repo/log.html b/appview/pages/templates/repo/log.html index a96b7721..5f8e79a3 100644 --- a/appview/pages/templates/repo/log.html +++ b/appview/pages/templates/repo/log.html @@ -87,7 +87,7 @@ {{ template "repo/pipelines/fragments/pipelineSymbolLong" (dict "Pipeline" $pipeline "RepoInfo" $.RepoInfo) }} {{ end }} - {{ timeFmt $commit.Committer.When }} + {{ template "repo/fragments/time" $commit.Committer.When }} {{ end }} @@ -163,7 +163,7 @@
- {{ shortTimeFmt $commit.Committer.When }} + {{ template "repo/fragments/shortTime" $commit.Committer.When }} {{ $pipeline := index $.Pipelines .Hash.String }} diff --git a/appview/pages/templates/repo/pipelines/pipelines.html b/appview/pages/templates/repo/pipelines/pipelines.html index 0d065385..457c1897 100644 --- a/appview/pages/templates/repo/pipelines/pipelines.html +++ b/appview/pages/templates/repo/pipelines/pipelines.html @@ -74,9 +74,7 @@
- + {{ template "repo/fragments/shortTimeAgo" .Created }}
{{ $t := .TimeTaken }} diff --git a/appview/pages/templates/repo/pulls/fragments/pullHeader.html b/appview/pages/templates/repo/pulls/fragments/pullHeader.html index 0d8b3d5f..ec3355fd 100644 --- a/appview/pages/templates/repo/pulls/fragments/pullHeader.html +++ b/appview/pages/templates/repo/pulls/fragments/pullHeader.html @@ -31,7 +31,7 @@ {{ $owner := index $.DidHandleMap .Pull.OwnerDid }} {{ template "user/fragments/picHandleLink" $owner }} - + {{ template "repo/fragments/time" .Pull.Created }} diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index c65684b6..2d5ce34c 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -55,7 +55,7 @@ by {{ template "user/fragments/picHandleLink" $owner }} - + {{ template "repo/fragments/shortTime" .Created }} {{ $s := "s" }} {{ if eq (len .Comments) 1 }} @@ -154,7 +154,7 @@ {{ $owner := index $.DidHandleMap $c.OwnerDid }} {{ template "user/fragments/picHandleLink" $owner }} - + {{ template "repo/fragments/time" $c.Created }}
{{ $c.Body | markdown }} diff --git a/appview/pages/templates/repo/pulls/pulls.html b/appview/pages/templates/repo/pulls/pulls.html index 95fe805d..7836be29 100644 --- a/appview/pages/templates/repo/pulls/pulls.html +++ b/appview/pages/templates/repo/pulls/pulls.html @@ -79,10 +79,8 @@ {{ template "user/fragments/picHandleLink" $owner }} - - + + {{ template "repo/fragments/time" .Created }} diff --git a/appview/pages/templates/repo/tags.html b/appview/pages/templates/repo/tags.html index a17d05fd..2fe3fa1f 100644 --- a/appview/pages/templates/repo/tags.html +++ b/appview/pages/templates/repo/tags.html @@ -35,7 +35,7 @@ {{ .Tag.Tagger.Name }} - + {{ template "repo/fragments/shortTime" .Tag.Tagger.When }} {{ end }}
@@ -54,7 +54,7 @@ {{ slice .Tag.Target.String 0 8 }} {{ .Tag.Tagger.Name }} - + {{ template "repo/fragments/time" .Tag.Tagger.When }} {{ end }} diff --git a/appview/pages/templates/repo/tree.html b/appview/pages/templates/repo/tree.html index 185d3ec3..fbaadbb5 100644 --- a/appview/pages/templates/repo/tree.html +++ b/appview/pages/templates/repo/tree.html @@ -65,7 +65,7 @@ {{ if .LastCommit}}
{{ .LastCommit.Message }} - + {{ template "repo/fragments/time" .LastCommit.When }}
{{ end }} @@ -85,7 +85,7 @@ {{ if .LastCommit}}
{{ .LastCommit.Message }} - + {{ template "repo/fragments/time" .LastCommit.When }}
{{ end }} diff --git a/appview/pages/templates/settings.html b/appview/pages/templates/settings.html index 14057914..8a1979ba 100644 --- a/appview/pages/templates/settings.html +++ b/appview/pages/templates/settings.html @@ -39,7 +39,7 @@ {{ i "key" "w-3 h-3 dark:text-gray-300" }}

{{ .Name }}

-

added {{ .Created | timeFmt }}

+

added {{ template "repo/fragments/time" .Created }}

{{ .Key }}
@@ -112,7 +112,7 @@ {{ end }} -

added {{ .CreatedAt | timeFmt }}

+

added {{ template "repo/fragments/time" .CreatedAt }}

{{ if not .Verified }} diff --git a/appview/pages/templates/spindles/fragments/spindleListing.html b/appview/pages/templates/spindles/fragments/spindleListing.html index 71a5e73a..56ae1e03 100644 --- a/appview/pages/templates/spindles/fragments/spindleListing.html +++ b/appview/pages/templates/spindles/fragments/spindleListing.html @@ -11,7 +11,7 @@ {{ i "hard-drive" "w-4 h-4" }} {{ .Instance }} - {{ .Created | shortTimeFmt }} ago + {{ template "repo/fragments/shortTimeAgo" .Created }} {{ else }} @@ -19,7 +19,7 @@ {{ i "hard-drive" "w-4 h-4" }} {{ .Instance }} - {{ .Created | shortTimeFmt }} ago + {{ template "repo/fragments/shortTimeAgo" .Created }}
{{ end }} diff --git a/appview/pages/templates/timeline.html b/appview/pages/templates/timeline.html index 2aa16f75..93708dd0 100644 --- a/appview/pages/templates/timeline.html +++ b/appview/pages/templates/timeline.html @@ -84,9 +84,9 @@ >{{ .Repo.Name }} {{ end }} - {{ template "repo/fragments/time" .Repo.Created }}

@@ -98,9 +98,9 @@ {{ template "user/fragments/picHandleLink" $userHandle }} followed {{ template "user/fragments/picHandleLink" $subjectHandle }} - {{ template "repo/fragments/time" .Follow.FollowedAt }}

@@ -116,9 +116,9 @@ class="no-underline hover:underline" >{{ $repoOwnerHandle | truncateAt30 }}/{{ .Star.Repo.Name }} - {{ template "repo/fragments/time" .Star.Created }}