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>
<div class="labelinput">
<label for="username">
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>
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>
</label>
<input
id="username"
type="text"
name="username"
required
placeholder="Please enter your desired username"
pattern="^[a-z0-9_]{1,64}$"
<input id="username" 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"
value="{{- .preferredUsername -}}"
>
value="{{- .preferredUsername -}}">
</div>
<input type="hidden" name="name" value="{{- .name -}}">
<button type="submit" class="btn btn-success">Submit</button>

View file

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

View file

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

View file

@ -27,70 +27,40 @@
<form action="/signup" method="POST">
<div class="labelinput">
<label for="email">Email</label>
<input
id="email"
type="email"
name="email"
required
placeholder="Email address"
>
<input id="email" type="email" name="email" required placeholder="Email address">
</div>
<div class="labelinput">
<label for="password">Password</label>
<input
id="password"
type="password"
name="password"
required
placeholder="Please enter your desired password"
autocomplete="new-password"
>
<input id="password" type="password" name="password" required
placeholder="Please enter your desired password" autocomplete="new-password">
</div>
<div class="labelinput">
<label for="username">
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>
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>
</label>
<input
id="username"
type="text"
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"
>
<input id="username" type="text" 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>
{{- if .reasonRequired }}
<div class="labelinput">
<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>
</label>
<textarea
id="reason"
name="reason"
required
<textarea 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."
rows="8"
minlength="40"
maxlength="500"
autocapitalize="sentences"
title="40-500 characters"
></textarea>
rows="8" minlength="40" maxlength="500" autocapitalize="sentences"
title="40-500 characters"></textarea>
</div>
{{- end }}
<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>
<input
id="agreement"
type="checkbox"
name="agreement"
required
value="true"
>
<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>
<input id="agreement" type="checkbox" name="agreement" required value="true">
</div>
<input type="hidden" name="locale" value="en">
<button type="submit" class="btn btn-success">Submit</button>

View file

@ -22,7 +22,7 @@
<section aria-labelledby="signed-up">
<h2 id="signed-up">Thanks for signing up to {{ .instance.Title -}}!</h2>
<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>Once an admin has approved your sign-up, you will be able to log in and use your account.</p>
</section>

View file

@ -38,7 +38,8 @@
{{- if .SpoilerText }}
<details class="text-spoiler">
<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>
</summary>
<div class="text">
@ -68,22 +69,12 @@
{{- include "status_info.tmpl" . | indent 1 }}
</aside>
{{- if .Local }}
<a
href="{{- .URL -}}"
class="status-link"
data-nosnippet
title="Open thread at this post"
>
<a href="{{- .URL -}}" class="status-link" data-nosnippet title="Open thread at this post">
Open thread at this post
</a>
{{- else }}
<a
href="{{- .URL -}}"
class="status-link"
data-nosnippet
rel="nofollow noreferrer noopener" target="_blank"
title="Open remote post (opens in a new window)"
>
<a href="{{- .URL -}}" 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)
</a>
{{- end }}

View file

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

View file

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

View file

@ -23,11 +23,11 @@
*/ -}}
{{- define "votes" -}}
{{- if eq . 1 -}}
{{- . -}}&nbsp;vote
{{- else -}}
{{- . }}&nbsp;votes
{{- end -}}
{{- if eq . 1 -}}
{{- . -}}&nbsp;vote
{{- else -}}
{{- . }}&nbsp;votes
{{- end -}}
{{- end -}}
{{- with . }}