Some checks failed
Architecture Lint / Linter Tests (push) Successful in 10s
Smoke Test / smoke (push) Failing after 7s
Validate Config / YAML Lint (push) Failing after 7s
Validate Config / JSON Validate (push) Successful in 7s
Architecture Lint / Lint Repository (push) Has been cancelled
Validate Config / Playbook Schema Validation (push) Has been cancelled
Validate Config / Python Test Suite (push) Has been cancelled
Validate Config / Cron Syntax Check (push) Has been cancelled
Validate Config / Deploy Script Dry Run (push) Has been cancelled
Validate Config / Python Syntax & Import Check (push) Has been cancelled
Validate Config / Shell Script Lint (push) Has been cancelled
Merge PR #569 Co-authored-by: Timmy Time <timmy@alexanderwhitestone.ai> Co-committed-by: Timmy Time <timmy@alexanderwhitestone.ai>
28 lines
824 B
Cheetah
28 lines
824 B
Cheetah
{{/*
|
|
Gitea a11y fix: R4 <time> elements for relative timestamps
|
|
Deploy to: custom/templates/custom/time_relative.tmpl
|
|
*/}}
|
|
|
|
{{define "custom/time_relative"}}
|
|
{{if and .Time .Relative}}
|
|
<time datetime="{{.Time.Format "2006-01-02T15:04:05Z07:00"}}" title="{{.Time.Format "Jan 02, 2006 15:04"}}">
|
|
{{.Relative}}
|
|
</time>
|
|
{{else if .Relative}}
|
|
<span>{{.Relative}}</span>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{define "custom/time_from_unix"}}
|
|
{{if .Relative}}
|
|
<time datetime="" data-unix="{{.Unix}}" title="">{{.Relative}}</time>
|
|
<script>
|
|
(function() {
|
|
var el = document.currentScript.previousElementSibling;
|
|
var unix = parseInt(el.getAttribute('data-unix'));
|
|
if (unix) { el.setAttribute('datetime', new Date(unix * 1000).toISOString()); el.setAttribute('title', new Date(unix * 1000).toLocaleString()); }
|
|
})();
|
|
</script>
|
|
{{end}}
|
|
{{end}}
|