diff options
Diffstat (limited to 'themes/default/layouts/partials')
-rw-r--r-- | themes/default/layouts/partials/function-content.html | 13 | ||||
-rw-r--r-- | themes/default/layouts/partials/function-strings.html | 6 | ||||
-rw-r--r-- | themes/default/layouts/partials/meta-expiry-date.html | 8 |
3 files changed, 17 insertions, 10 deletions
diff --git a/themes/default/layouts/partials/function-content.html b/themes/default/layouts/partials/function-content.html index be33ba0..de68946 100644 --- a/themes/default/layouts/partials/function-content.html +++ b/themes/default/layouts/partials/function-content.html @@ -1,4 +1,7 @@ -{{- $content := . -}} +{{- $context := . -}} +{{- $content := $context.Content -}} +{{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} +{{- $empty := eq (len $content) 0 -}} {{- $content = $content | @@ -7,8 +10,12 @@ replaceRE "</figure></p>" "</figure>" | -}} -{{- if eq (len $content) 0 -}} - {{- $content = partial "function-strings.html" "messageNoContent" -}} +{{- if $empty -}} + {{- $content = "This message contains no content." -}} +{{- end -}} + +{{- if $expired -}} + {{- $content = "This message has expired." -}} {{- end -}} {{- return $content -}} diff --git a/themes/default/layouts/partials/function-strings.html b/themes/default/layouts/partials/function-strings.html deleted file mode 100644 index 37de01a..0000000 --- a/themes/default/layouts/partials/function-strings.html +++ /dev/null @@ -1,6 +0,0 @@ -{{- $string := . -}} - -{{- if eq $string "messageExpired" -}} {{- $string = "This message has expired." -}} {{- end -}} -{{- if eq $string "messageNoContent" -}} {{- $string = "This message contains no content." -}} {{- end -}} - -{{- return $string -}} diff --git a/themes/default/layouts/partials/meta-expiry-date.html b/themes/default/layouts/partials/meta-expiry-date.html index e2c4838..62f01da 100644 --- a/themes/default/layouts/partials/meta-expiry-date.html +++ b/themes/default/layouts/partials/meta-expiry-date.html @@ -1,9 +1,15 @@ {{- if .ExpiryDate -}} + {{- $expired := and .ExpiryDate (ge now.Unix .ExpiryDate.Unix) -}} {{- $diff := now.Sub .ExpiryDate -}} {{- $duration := lang.FormatNumberCustom 0 (math.Round (mul (div $diff.Hours 24) -1)) -}} + {{- $date := .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" -}} + {{- $title := print "Self destructs within" " " $duration " " "days" " " "(" $date ")" -}} + {{- if $expired -}} + {{- $title = print "Self destructed" " " $date -}} + {{- end -}} <micro-metadata-expiry - title="Self destructs within {{ $duration }} days ({{ .ExpiryDate | time.Format "Monday, January 2 2006 at 15:04:05 MST" }})"> + title="{{ $title }}"> {{- safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/trash-2.svg")) -}} <time datetime= "{{- .ExpiryDate | time.Format "2006-01-02T15:04:05Z" -}}"> {{- .ExpiryDate | time.Format "Jan 2 2006" -}} |