auto-format other templates for consistency

This commit is contained in:
f0x 2024-07-30 17:26:55 +02:00
parent 99a79266f6
commit 8342c7aae7
10 changed files with 113 additions and 248 deletions

View file

@ -31,19 +31,14 @@
</p> </p>
<div class="labelinput"> <div class="labelinput">
<label for="username"> <label for="username">
Username (lowercase a-z, numbers, and underscores; max 64 characters).<br/> Username (lowercase a-z, numbers, and underscores; max 64 characters).<br />
<small>Your username will be part of your fediverse handle, and cannot be changed later, so choose thoughtfully!</small> <small>Your username will be part of your fediverse handle, and cannot be changed later, so choose
thoughtfully!</small>
</label> </label>
<input <input id="username" type="text" name="username" required
id="username" placeholder="Please enter your desired username" pattern="^[a-z0-9_]{1,64}$"
type="text"
name="username"
required
placeholder="Please enter your desired username"
pattern="^[a-z0-9_]{1,64}$"
title="lowercase a-z, numbers, and underscores; max 64 characters" title="lowercase a-z, numbers, and underscores; max 64 characters"
value="{{- .preferredUsername -}}" value="{{- .preferredUsername -}}">
>
</div> </div>
<input type="hidden" name="name" value="{{- .name -}}"> <input type="hidden" name="name" value="{{- .name -}}">
<button type="submit" class="btn btn-success">Submit</button> <button type="submit" class="btn btn-success">Submit</button>

View file

@ -21,20 +21,13 @@
<nav> <nav>
<ul class="nodot"> <ul class="nodot">
<li id="about"> <li id="about">
<a <a href="/about" class="nounderline">
href="/about"
class="nounderline"
>
About {{ .instance.Title }} About {{ .instance.Title }}
</a> </a>
</li> </li>
<li id="version"> <li id="version">
<a <a href="https://github.com/superseriousbusiness/gotosocial" class="nounderline"
href="https://github.com/superseriousbusiness/gotosocial" rel="nofollow noreferrer noopener" target="_blank">
class="nounderline"
rel="nofollow noreferrer noopener"
target="_blank"
>
<span aria-hidden="true">🦥</span> <span aria-hidden="true">🦥</span>
Source - GoToSocial {{ .instance.Version }} Source - GoToSocial {{ .instance.Version }}
<span aria-hidden="true">🦥</span> <span aria-hidden="true">🦥</span>
@ -42,22 +35,15 @@
</li> </li>
{{- if .instance.ContactAccount }} {{- if .instance.ContactAccount }}
<li id="contact"> <li id="contact">
<a <a href="/@{{- .instance.ContactAccount.Username -}}" class="nounderline">
href="/@{{- .instance.ContactAccount.Username -}}"
class="nounderline"
>
Contact account - {{ .instance.ContactAccount.Username }} Contact account - {{ .instance.ContactAccount.Username }}
</a> </a>
</li> </li>
{{- end }} {{- end }}
{{- if .instance.Email }} {{- if .instance.Email }}
<li id="email"> <li id="email">
<a <a href="mailto:{{- .instance.Email -}}" class="nounderline" rel="nofollow noreferrer noopener"
href="mailto:{{- .instance.Email -}}" target="_blank">
class="nounderline"
rel="nofollow noreferrer noopener"
target="_blank"
>
Email - {{ .instance.Email }} Email - {{ .instance.Email }}
</a> </a>
</li> </li>

View file

@ -27,31 +27,31 @@ Instance Logo
{{- define "strapUsers" -}} {{- define "strapUsers" -}}
{{- with deref .instance.Stats.user_count -}} {{- with deref .instance.Stats.user_count -}}
{{- if eq . 1 -}} {{- if eq . 1 -}}
<span class="count">{{- . -}}</span> user <span class="count">{{- . -}}</span> user
{{- else -}} {{- else -}}
<span class="count">{{- . -}}</span> users <span class="count">{{- . -}}</span> users
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "strapPosts" -}} {{- define "strapPosts" -}}
{{- with deref .instance.Stats.status_count -}} {{- with deref .instance.Stats.status_count -}}
{{- if eq . 1 -}} {{- if eq . 1 -}}
<span class="count">{{- . -}}</span> post <span class="count">{{- . -}}</span> post
{{- else -}} {{- else -}}
<span class="count">{{- . -}}</span> posts <span class="count">{{- . -}}</span> posts
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "strapInstances" -}} {{- define "strapInstances" -}}
{{- with deref .instance.Stats.domain_count -}} {{- with deref .instance.Stats.domain_count -}}
{{- if eq . 1 -}} {{- if eq . 1 -}}
<span class="count">{{- . -}}</span> other instance <span class="count">{{- . -}}</span> other instance
{{- else -}} {{- else -}}
<span class="count">{{- . -}}</span> other instances <span class="count">{{- . -}}</span> other instances
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -59,21 +59,16 @@ Instance Logo
<a aria-label="{{- .instance.Title -}}. Go to instance homepage" href="/" class="nounderline"> <a aria-label="{{- .instance.Title -}}. Go to instance homepage" href="/" class="nounderline">
<picture> <picture>
{{- if .instance.ThumbnailStatic }} {{- if .instance.ThumbnailStatic }}
<source <source srcset="{{- .instance.ThumbnailStatic -}}" type="{{- .instance.ThumbnailStaticType -}}"
srcset="{{- .instance.ThumbnailStatic -}}" media="(prefers-reduced-motion: reduce)" />
type="{{- .instance.ThumbnailStaticType -}}"
media="(prefers-reduced-motion: reduce)"
/>
{{- end }} {{- end }}
<img <img src="{{- .instance.Thumbnail -}}" alt="{{- template "thumbnailDescription" . -}}"
src="{{- .instance.Thumbnail -}}" title="{{- template "thumbnailDescription" . -}}" />
alt="{{- template "thumbnailDescription" . -}}"
title="{{- template "thumbnailDescription" . -}}"
/>
</picture> </picture>
<h1>{{- .instance.Title -}}</h1> <h1>{{- .instance.Title -}}</h1>
</a> </a>
{{- if .showStrap }} {{- if .showStrap }}
<aside>home to {{ template "strapUsers" . }} who wrote {{ template "strapPosts" . }}, federating with {{ template "strapInstances" . }}</aside> <aside>home to {{ template "strapUsers" . }} who wrote {{ template "strapPosts" . }}, federating with
{{ template "strapInstances" . }}</aside>
{{- end }} {{- end }}
{{- end }} {{- end }}

View file

@ -27,70 +27,40 @@
<form action="/signup" method="POST"> <form action="/signup" method="POST">
<div class="labelinput"> <div class="labelinput">
<label for="email">Email</label> <label for="email">Email</label>
<input <input id="email" type="email" name="email" required placeholder="Email address">
id="email"
type="email"
name="email"
required
placeholder="Email address"
>
</div> </div>
<div class="labelinput"> <div class="labelinput">
<label for="password">Password</label> <label for="password">Password</label>
<input <input id="password" type="password" name="password" required
id="password" placeholder="Please enter your desired password" autocomplete="new-password">
type="password"
name="password"
required
placeholder="Please enter your desired password"
autocomplete="new-password"
>
</div> </div>
<div class="labelinput"> <div class="labelinput">
<label for="username"> <label for="username">
Username (lowercase a-z, numbers, and underscores; max 64 characters).<br/> Username (lowercase a-z, numbers, and underscores; max 64 characters).<br />
<small>Your username will be part of your fediverse handle, and cannot be changed later, so choose thoughtfully!</small> <small>Your username will be part of your fediverse handle, and cannot be changed later, so choose
thoughtfully!</small>
</label> </label>
<input <input id="username" type="text" name="username" required
id="username" placeholder="Please enter your desired username" pattern="^[a-z0-9_]{1,64}$" autocapitalize="off"
type="text" spellcheck="false" title="lowercase a-z, numbers, and underscores; max 64 characters">
name="username"
required
placeholder="Please enter your desired username"
pattern="^[a-z0-9_]{1,64}$"
autocapitalize="off"
spellcheck="false"
title="lowercase a-z, numbers, and underscores; max 64 characters"
>
</div> </div>
{{- if .reasonRequired }} {{- if .reasonRequired }}
<div class="labelinput"> <div class="labelinput">
<label for="reason"> <label for="reason">
Reason you want to join {{ .instance.Title }} (40-500 characters).<br/> Reason you want to join {{ .instance.Title }} (40-500 characters).<br />
<small>The admin(s) will use this text to decide whether or not to approve your sign-up.</small> <small>The admin(s) will use this text to decide whether or not to approve your sign-up.</small>
</label> </label>
<textarea <textarea id="reason" name="reason" required
id="reason"
name="reason"
required
placeholder="Enter a few sentences about why you want to join this instance. If you know someone on the instance already, you may want to mention them here. You might want to link to any other accounts you have elsewhere too." placeholder="Enter a few sentences about why you want to join this instance. If you know someone on the instance already, you may want to mention them here. You might want to link to any other accounts you have elsewhere too."
rows="8" rows="8" minlength="40" maxlength="500" autocapitalize="sentences"
minlength="40" title="40-500 characters"></textarea>
maxlength="500"
autocapitalize="sentences"
title="40-500 characters"
></textarea>
</div> </div>
{{- end }} {{- end }}
<div class="checkbox"> <div class="checkbox">
<label for="agreement">I have read and accept the <a href="/about#terms">terms and conditions</a> of {{ .instance.Title }}, and I agree to abide by the <a href="/about#rules">instance rules</a>.</label> <label for="agreement">I have read and accept the <a href="/about#terms">terms and conditions</a> of
<input {{ .instance.Title }}, and I agree to abide by the <a href="/about#rules">instance
id="agreement" rules</a>.</label>
type="checkbox" <input id="agreement" type="checkbox" name="agreement" required value="true">
name="agreement"
required
value="true"
>
</div> </div>
<input type="hidden" name="locale" value="en"> <input type="hidden" name="locale" value="en">
<button type="submit" class="btn btn-success">Submit</button> <button type="submit" class="btn btn-success">Submit</button>

View file

@ -22,7 +22,7 @@
<section aria-labelledby="signed-up"> <section aria-labelledby="signed-up">
<h2 id="signed-up">Thanks for signing up to {{ .instance.Title -}}!</h2> <h2 id="signed-up">Thanks for signing up to {{ .instance.Title -}}!</h2>
<p>Hi <b>{{- .username -}}</b>!</p> <p>Hi <b>{{- .username -}}</b>!</p>
<p>Your sign-up has been registered, and a confirmation email has been sent to <b>{{- .email -}}</b>.<p> <p>Your sign-up has been registered, and a confirmation email has been sent to <b>{{- .email -}}</b>.</p>
<p>Please check your email inbox and click the link to confirm your email.</p> <p>Please check your email inbox and click the link to confirm your email.</p>
<p>Once an admin has approved your sign-up, you will be able to log in and use your account.</p> <p>Once an admin has approved your sign-up, you will be able to log in and use your account.</p>
</section> </section>

View file

@ -38,7 +38,8 @@
{{- if .SpoilerText }} {{- if .SpoilerText }}
<details class="text-spoiler"> <details class="text-spoiler">
<summary> <summary>
<span class="spoiler-text" lang="{{- .LanguageTag.TagStr -}}">{{- emojify .Emojis (escape .SpoilerText) -}}</span> <span class="spoiler-text"
lang="{{- .LanguageTag.TagStr -}}">{{- emojify .Emojis (escape .SpoilerText) -}}</span>
<span class="button" role="button" tabindex="0">Toggle visibility</span> <span class="button" role="button" tabindex="0">Toggle visibility</span>
</summary> </summary>
<div class="text"> <div class="text">
@ -68,22 +69,12 @@
{{- include "status_info.tmpl" . | indent 1 }} {{- include "status_info.tmpl" . | indent 1 }}
</aside> </aside>
{{- if .Local }} {{- if .Local }}
<a <a href="{{- .URL -}}" class="status-link" data-nosnippet title="Open thread at this post">
href="{{- .URL -}}"
class="status-link"
data-nosnippet
title="Open thread at this post"
>
Open thread at this post Open thread at this post
</a> </a>
{{- else }} {{- else }}
<a <a href="{{- .URL -}}" class="status-link" data-nosnippet rel="nofollow noreferrer noopener" target="_blank"
href="{{- .URL -}}" title="Open remote post (opens in a new window)">
class="status-link"
data-nosnippet
rel="nofollow noreferrer noopener" target="_blank"
title="Open remote post (opens in a new window)"
>
Open remote post (opens in a new window) Open remote post (opens in a new window)
</a> </a>
{{- end }} {{- end }}

View file

@ -23,54 +23,23 @@
*/ -}} */ -}}
{{- define "imagePreview" }} {{- define "imagePreview" }}
<img <img src="{{- .PreviewURL -}}" loading="lazy" {{- if .Description }} alt="{{- .Description -}}"
src="{{- .PreviewURL -}}" title="{{- .Description -}}" {{- end }} width="{{- .Meta.Original.Width -}}"
loading="lazy" height="{{- .Meta.Original.Height -}}" />
{{- if .Description }}
alt="{{- .Description -}}"
title="{{- .Description -}}"
{{- end }}
width="{{- .Meta.Original.Width -}}"
height="{{- .Meta.Original.Height -}}"
/>
{{- end }} {{- end }}
{{- define "videoPreview" }} {{- define "videoPreview" }}
<img <img src="{{- .PreviewURL -}}" loading="lazy" {{- if .Description }} alt="{{- .Description -}}"
src="{{- .PreviewURL -}}" title="{{- .Description -}}" {{- end }} width="{{- .Meta.Small.Width -}}" height="{{- .Meta.Small.Height -}}" />
loading="lazy"
{{- if .Description }}
alt="{{- .Description -}}"
title="{{- .Description -}}"
{{- end }}
width="{{- .Meta.Small.Width -}}"
height="{{- .Meta.Small.Height -}}"
/>
{{- end }} {{- end }}
{{- define "audioPreview" }} {{- define "audioPreview" }}
{{- if and .PreviewURL .Meta.Small.Width }} {{- if and .PreviewURL .Meta.Small.Width }}
<img <img src="{{- .PreviewURL -}}" loading="lazy" {{- if .Description }} alt="{{- .Description -}}"
src="{{- .PreviewURL -}}" title="{{- .Description -}}" {{- end }} width="{{- .Meta.Small.Width -}}" height="{{- .Meta.Small.Height -}}" />
loading="lazy"
{{- if .Description }}
alt="{{- .Description -}}"
title="{{- .Description -}}"
{{- end }}
width="{{- .Meta.Small.Width -}}"
height="{{- .Meta.Small.Height -}}"
/>
{{- else }} {{- else }}
<img <img src="/assets/logo.webp" loading="lazy" {{- if .Description }} alt="{{- .Description -}}"
src="/assets/logo.webp" title="{{- .Description -}}" {{- end }} width="518" height="460" />
loading="lazy"
{{- if .Description }}
alt="{{- .Description -}}"
title="{{- .Description -}}"
{{- end }}
width="518"
height="460"
/>
{{- end }} {{- end }}
{{- end }} {{- end }}
@ -85,11 +54,7 @@ media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{
{{- end -}} {{- end -}}
{{- with .MediaAttachments }} {{- with .MediaAttachments }}
<div <div class="{{- template "galleryClass" . -}}" role="group" aria-label="{{- template "attachmentsLength" . -}}">
class="{{- template "galleryClass" . -}}"
role="group"
aria-label="{{- template "attachmentsLength" . -}}"
>
{{- range $index, $media := . }} {{- range $index, $media := . }}
<div class="media-wrapper"> <div class="media-wrapper">
<details class="{{- $media.Type -}}-spoiler media-spoiler" {{- if not $media.Sensitive }} open{{- end -}}> <details class="{{- $media.Type -}}-spoiler media-spoiler" {{- if not $media.Sensitive }} open{{- end -}}>
@ -108,72 +73,35 @@ media photoswipe-gallery {{ (len .) | oddOrEven }} {{ if eq (len .) 1 }}single{{
{{- end }} {{- end }}
</summary> </summary>
{{- if eq .Type "video" }} {{- if eq .Type "video" }}
<video <video preload="none" class="plyr-video photoswipe-slide" controls data-pswp-index="{{- $index -}}"
preload="none" poster="{{- .PreviewURL -}}" data-pswp-width="{{- $media.Meta.Small.Width -}}px"
class="plyr-video photoswipe-slide" data-pswp-height="{{- $media.Meta.Small.Height -}}px" {{- if .Description }}
controls alt="{{- $media.Description -}}" title="{{- $media.Description -}}" {{- end }}>
data-pswp-index="{{- $index -}}" <source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}" />
poster="{{- .PreviewURL -}}"
data-pswp-width="{{- $media.Meta.Small.Width -}}px"
data-pswp-height="{{- $media.Meta.Small.Height -}}px"
{{- if .Description }}
alt="{{- $media.Description -}}"
title="{{- $media.Description -}}"
{{- end }}
>
<source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}"/>
</video> </video>
{{- else if eq .Type "audio" }} {{- else if eq .Type "audio" }}
<video <video preload="none" class="plyr-video photoswipe-slide" controls data-pswp-index="{{- $index -}}"
preload="none" {{- if and $media.PreviewURL $media.Meta.Small.Width }} poster="{{- .PreviewURL -}}"
class="plyr-video photoswipe-slide"
controls
data-pswp-index="{{- $index -}}"
{{- if and $media.PreviewURL $media.Meta.Small.Width }}
poster="{{- .PreviewURL -}}"
data-pswp-width="{{- $media.Meta.Small.Width -}}px" data-pswp-width="{{- $media.Meta.Small.Width -}}px"
data-pswp-height="{{- $media.Meta.Small.Height -}}px" data-pswp-height="{{- $media.Meta.Small.Height -}}px" {{- else }} poster="/assets/logo.webp"
{{- else }} width="518px" height="460px" {{- end }} {{- if .Description }} alt="{{- $media.Description -}}"
poster="/assets/logo.webp" title="{{- $media.Description -}}" {{- end }}>
width="518px" <source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}" />
height="460px"
{{- end }}
{{- if .Description }}
alt="{{- $media.Description -}}"
title="{{- $media.Description -}}"
{{- end }}
>
<source type="{{- $media.MIMEType -}}" src="{{- $media.URL -}}"/>
</video> </video>
{{- else if eq .Type "image" }} {{- else if eq .Type "image" }}
<a <a class="photoswipe-slide" href="{{- $media.URL -}}" target="_blank"
class="photoswipe-slide"
href="{{- $media.URL -}}"
target="_blank"
data-pswp-width="{{- $media.Meta.Original.Width -}}px" data-pswp-width="{{- $media.Meta.Original.Width -}}px"
data-pswp-height="{{- $media.Meta.Original.Height -}}px" data-pswp-height="{{- $media.Meta.Original.Height -}}px" data-cropped="true" {{- if .Description }}
data-cropped="true" alt="{{- $media.Description -}}" title="{{- $media.Description -}}" {{- end }}>
{{- if .Description }}
alt="{{- $media.Description -}}"
title="{{- $media.Description -}}"
{{- end }}
>
{{- with $media }} {{- with $media }}
{{- include "imagePreview" . | indent 4 }} {{- include "imagePreview" . | indent 4 }}
{{- end }} {{- end }}
</a> </a>
{{- else }} {{- else }}
<a <a class="unknown-attachment" href="{{- $media.RemoteURL -}}" rel="nofollow noreferrer noopener"
class="unknown-attachment" target="_blank" {{- if .Description }}
href="{{- $media.RemoteURL -}}" title="Open external media: {{ $media.Description -}}&#10;&#13;{{- $media.RemoteURL -}}" {{- else }}
rel="nofollow noreferrer noopener" title="Open external media.&#10;&#13;{{- $media.RemoteURL -}}" {{- end }}>
target="_blank"
{{- if .Description }}
title="Open external media: {{ $media.Description -}}&#10;&#13;{{- $media.RemoteURL -}}"
{{- else }}
title="Open external media.&#10;&#13;{{- $media.RemoteURL -}}"
{{- end }}
>
<div class="placeholder" aria-hidden="true"> <div class="placeholder" aria-hidden="true">
<i class="placeholder-external-link fa fa-external-link"></i> <i class="placeholder-external-link fa fa-external-link"></i>
<i class="placeholder-icon fa fa-file-text"></i> <i class="placeholder-icon fa fa-file-text"></i>

View file

@ -20,31 +20,31 @@
{{- define "ariaLabel" -}} {{- define "ariaLabel" -}}
@{{ .Account.Acct -}}, {{ timestamp .CreatedAt -}} @{{ .Account.Acct -}}, {{ timestamp .CreatedAt -}}
{{- if .LanguageTag -}} {{- if .LanguageTag -}}
, language {{ .LanguageTag.DisplayStr -}} , language {{ .LanguageTag.DisplayStr -}}
{{- end -}} {{- end -}}
{{- if .MediaAttachments -}} {{- if .MediaAttachments -}}
, has media , has media
{{- end -}} {{- end -}}
{{- if .RepliesCount -}} {{- if .RepliesCount -}}
{{- if eq .RepliesCount 1 -}} {{- if eq .RepliesCount 1 -}}
, 1 reply , 1 reply
{{- else -}} {{- else -}}
, {{ .RepliesCount }} replies , {{ .RepliesCount }} replies
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if .FavouritesCount -}} {{- if .FavouritesCount -}}
{{- if eq .FavouritesCount 1 -}} {{- if eq .FavouritesCount 1 -}}
, 1 favourite , 1 favourite
{{- else -}} {{- else -}}
, {{ .FavouritesCount }} favourites , {{ .FavouritesCount }} favourites
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if .ReblogsCount -}} {{- if .ReblogsCount -}}
{{- if eq .ReblogsCount 1 -}} {{- if eq .ReblogsCount 1 -}}
, 1 boost , 1 boost
{{- else -}} {{- else -}}
, {{ .ReblogsCount }} boosts , {{ .ReblogsCount }} boosts
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

View file

@ -23,11 +23,11 @@
*/ -}} */ -}}
{{- define "votes" -}} {{- define "votes" -}}
{{- if eq . 1 -}} {{- if eq . 1 -}}
{{- . -}}&nbsp;vote {{- . -}}&nbsp;vote
{{- else -}} {{- else -}}
{{- . }}&nbsp;votes {{- . }}&nbsp;votes
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- with . }} {{- with . }}
@ -51,14 +51,14 @@
<span class="total-votes"> <span class="total-votes">
{{- template "votes" .Poll.VotesCount -}}&nbsp; {{- template "votes" .Poll.VotesCount -}}&nbsp;
{{- if .Poll.Expired -}} {{- if .Poll.Expired -}}
total total
{{- else -}} {{- else -}}
so far so far
{{- end -}} {{- end -}}
</span> </span>
</figcaption> </figcaption>
<ul class="poll-options nodot"> <ul class="poll-options nodot">
{{- range $index, $pollOption := .PollOptions }} {{- range $index, $pollOption := .PollOptions }}
<li class="poll-option"> <li class="poll-option">
<span class="sr-only">Option {{ increment $index }},</span> <span class="sr-only">Option {{ increment $index }},</span>
<span lang="{{- .LanguageTag.TagStr -}}">{{ emojify .Emojis (noescape $pollOption.Title) }}</span> <span lang="{{- .LanguageTag.TagStr -}}">{{ emojify .Emojis (noescape $pollOption.Title) }}</span>
@ -75,7 +75,7 @@
{{- end }} {{- end }}
</div> </div>
</li> </li>
{{- end }} {{- end }}
</ul> </ul>
</figure> </figure>
{{- end }} {{- end }}