From aeb65bceae97611b8931de2e954df18afedd812f Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:36:03 +0200 Subject: [feature/frontend] Better visual separation between "main" thread and "replies" (#3093) * [feature/frontend] Better web threading model * fix test * bwap * tweaks * more tweaks to wording * typo * indenting * adjust wording * aaa --- web/template/thread.tmpl | 122 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 32 deletions(-) (limited to 'web/template/thread.tmpl') diff --git a/web/template/thread.tmpl b/web/template/thread.tmpl index 2231a5ab8..8b4aa2248 100644 --- a/web/template/thread.tmpl +++ b/web/template/thread.tmpl @@ -17,45 +17,103 @@ // along with this program. If not, see . */ -}} -{{- define "threadLength" -}} - {{- with $length := add (len $.context.Ancestors) (len $.context.Descendants) | increment -}} - {{- if eq $length 1 -}} - {{- $length }} post +{{- define "repliesSummary" -}} + {{- if .context.ThreadRepliesShown -}} + {{- if .context.ThreadRepliesHidden -}} + {{- if eq .context.ThreadReplies 1 -}} + {{- /* Some replies are hidden. */ -}} + {{ .context.ThreadRepliesShown }} visible reply + {{- else if gt .context.ThreadRepliesShown 1 -}} + {{ .context.ThreadRepliesShown }} visible replies + {{- end -}} + ; {{ .context.ThreadRepliesHidden }} more {{ if eq .context.ThreadRepliesHidden 1 }}reply{{ else }}replies{{ end }} hidden or not public {{- else -}} - {{- $length }} posts + {{- /* No hidden replies. */ -}} + {{- if eq .context.ThreadReplies 1 -}} + {{ .context.ThreadReplies }} reply + {{- else if gt .context.ThreadReplies 1 -}} + {{ .context.ThreadReplies }} replies + {{- end -}} {{- end -}} {{- end -}} {{- end -}} +{{- define "threadSummary" -}} + {{- if .context.ThreadHidden -}} + {{- if eq .context.ThreadShown 1 -}} + Single visible post + {{- else if gt .context.ThreadShown 1 -}} + Thread of {{ .context.ThreadShown }} visible posts + {{- end -}} + ; {{ .context.ThreadHidden }} more {{ if eq .context.ThreadHidden 1 }}post{{ else }}posts{{ end }} hidden or not public + {{- else -}} + {{- /* No hidden posts */ -}} + {{- if eq .context.ThreadLength 1 -}} + Single post + {{- else if gt .context.ThreadLength 1 -}} + Thread of {{ .context.ThreadLength }} posts + {{- end -}} + {{- end -}} +{{- end -}} + +{{- define "repliesStart" -}} {{- with . }} -
-
-

Thread with {{ template "threadLength" . -}}

- jump to expanded post + +
+
+

{{- template "repliesSummary" . -}}

+ back to top
- {{- range .context.Ancestors }} -
- {{- include "status.tmpl" . | indent 2 }} -
- {{- end }} - {{- with .status }} -
- {{- include "status.tmpl" . | indent 2 }} -
- {{- end }} - {{- range .context.Descendants }} -
- {{- include "status.tmpl" . | indent 2 }} -
+{{- end }} +{{- end -}} + +{{- with . }} +
+
+
+

{{- template "threadSummary" . -}}

+ {{- if .context.ThreadRepliesShown }} + jump to replies + {{- end }} +
+ + {{- range $thisStatus := .context.Ancestors }} + {{- if $thisStatus.ThreadFirstReply }} + {{- include "repliesStart" $ | indent 1 }} + {{- end }} +
+ {{- include "status.tmpl" $thisStatus | indent 3 }} +
+ {{- end }} + + {{- with $thisStatus := .context.Status }} + {{- if $thisStatus.ThreadFirstReply }} + {{- include "repliesStart" $ | indent 1 }} + {{- end }} +
+ {{- include "status.tmpl" $thisStatus | indent 3 }} +
+ {{- end }} + + {{- range $thisStatus := .context.Descendants }} + {{- if $thisStatus.ThreadFirstReply }} + {{- include "repliesStart" $ | indent 1 }} + {{- end }} +
+ {{- include "status.tmpl" $thisStatus | indent 3 }} +
+ {{- end }} + {{- if .context.ThreadReplies }} +
{{- end }}
{{- end }} \ No newline at end of file -- cgit v1.3