diff options
Diffstat (limited to 'web/template/thread.tmpl')
-rw-r--r-- | web/template/thread.tmpl | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/web/template/thread.tmpl b/web/template/thread.tmpl index f2b61019d..2231a5ab8 100644 --- a/web/template/thread.tmpl +++ b/web/template/thread.tmpl @@ -17,22 +17,45 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. */ -}} -{{ template "header.tmpl" .}} -<main> - <section data-nosnippet class="thread"> - {{range .context.Ancestors}} - <article class="toot" id="{{.ID}}"> - {{ template "status.tmpl" .}} - </article> - {{end}} - <article class="toot expanded" id="{{.status.ID}}"> - {{ template "status.tmpl" .status}} - </article> - {{range .context.Descendants}} - <article class="toot" id="{{.ID}}"> - {{ template "status.tmpl" .}} - </article> - {{end}} - </section> +{{- define "threadLength" -}} + {{- with $length := add (len $.context.Ancestors) (len $.context.Descendants) | increment -}} + {{- if eq $length 1 -}} + {{- $length }} post + {{- else -}} + {{- $length }} posts + {{- end -}} + {{- end -}} +{{- end -}} + +{{- with . }} +<main data-nosnippet class="thread" aria-labelledby="thread-summary"> + <div class="col-header"> + <h2 id="thread-summary">Thread with {{ template "threadLength" . -}}</h2> + <a href="#{{- .status.ID -}}">jump to expanded post</a> + </div> + {{- range .context.Ancestors }} + <article + class="status" + {{- includeAttr "status_attributes.tmpl" . | indentAttr 2 }} + > + {{- include "status.tmpl" . | indent 2 }} + </article> + {{- end }} + {{- with .status }} + <article + class="status expanded" + {{- includeAttr "status_attributes.tmpl" . | indentAttr 2 }} + > + {{- include "status.tmpl" . | indent 2 }} + </article> + {{- end }} + {{- range .context.Descendants }} + <article + class="status" + {{- includeAttr "status_attributes.tmpl" . | indentAttr 2 }} + > + {{- include "status.tmpl" . | indent 2 }} + </article> + {{- end }} </main> -{{ template "footer.tmpl" .}}
\ No newline at end of file +{{- end }}
\ No newline at end of file |