Versions are YYYY.MM.DD-N, injected with -ldflags from a git tag, so no file in the repo carries the number and a local build honestly says dev. The version shows in the footer, the startup log and /healthz. The song page's metadata was five different kinds of fact — artist, genre, duration, provenance and a badge about the viewer — in one flat run with two competing pills. Now the artist has its own line in the display face, and the facts sit in four labelled cells like the spine of a cassette insert. The submitter links to their profile, "oma kappale" became "lähetti: sinä", and the clock time is gone: nobody needs the minute a song was published.
152 lines
5.7 KiB
HTML
152 lines
5.7 KiB
HTML
{{define "content"}}
|
|
{{$s := .Data}}
|
|
<h1>{{$s.Title}}</h1>
|
|
<p class="by">{{$s.Artist}}</p>
|
|
|
|
<!-- Four different kinds of fact, so four labelled cells rather than one run of text. "Oma
|
|
kappale" belongs here as the submitter, not as a badge: it is a fact about you. -->
|
|
<dl class="spec">
|
|
<div><dt>Genre</dt><dd>{{$s.GenreLabel}}</dd></div>
|
|
<div><dt>Kesto</dt><dd>{{$s.Length}}</dd></div>
|
|
<div><dt>Lähetti</dt>
|
|
<dd>{{if $s.Own}}sinä{{else}}<a href="/profile/{{$s.SubmitterID}}">{{$s.Submitter}}</a>{{end}}</dd>
|
|
</div>
|
|
<div><dt>Julkaistu</dt><dd>{{fiday $s.CreatedAt}}</dd></div>
|
|
</dl>
|
|
|
|
{{if $s.CanEdit}}
|
|
<details class="editbox">
|
|
<summary>Muokkaa tietoja</summary>
|
|
<form method="post" action="/songs/{{$s.ID}}" class="stack">
|
|
<label>Nimi <input name="title" value="{{$s.Title}}" maxlength="100" required></label>
|
|
<label>Esittäjä <input name="artist" value="{{$s.Artist}}" maxlength="100" required></label>
|
|
<label>Genre
|
|
<select name="genre" required>
|
|
{{$current := $s.Genre}}
|
|
{{range $s.Genres}}
|
|
<option value="{{.Code}}" {{if eq .Code $current}}selected{{end}}>{{.Label}}</option>
|
|
{{end}}
|
|
</select>
|
|
</label>
|
|
<label>Esittely <textarea name="description" rows="4" maxlength="2000">{{$s.Description}}</textarea></label>
|
|
<button type="submit">Tallenna</button>
|
|
</form>
|
|
<form method="post" action="/songs/{{$s.ID}}/delete"
|
|
onsubmit="return confirm('Poistetaanko kappale lopullisesti?')">
|
|
<button type="submit" class="ghost danger">Poista kappale</button>
|
|
</form>
|
|
<p class="muted small">Muokkaus ja poisto ovat mahdollisia vain ennen ensimmäistä arvostelua.</p>
|
|
</details>
|
|
{{else if $s.Own}}
|
|
<p class="muted small">Kappaletta on jo arvosteltu, joten tietoja ei voi enää muuttaa.</p>
|
|
{{end}}
|
|
|
|
{{if $s.CanReview}}
|
|
<!-- The channel strip: the fader is the score, the panel beside it is everything else you do
|
|
while the track plays. -->
|
|
<form method="post" action="/songs/{{$s.ID}}/review" class="strip">
|
|
{{template "fader" 50}}
|
|
<div class="deck">
|
|
{{template "player" $s}}
|
|
{{with $s.Description}}<p class="intro">{{.}}</p>{{end}}
|
|
<label class="grow">Arvostelu
|
|
<textarea name="text" rows="8" maxlength="5000" required
|
|
placeholder="Mitä kuulit?"></textarea>
|
|
</label>
|
|
<div class="deckfoot">
|
|
<button type="submit">Tallenna arvostelu</button>
|
|
<span class="muted small">Muiden pisteet paljastuvat kun tallennat omasi. Voit muokata
|
|
tai poistaa arvostelusi 30 minuutin ajan.</span>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
{{else}}
|
|
{{template "player" $s}}
|
|
{{with $s.Description}}<p class="intro">{{.}}</p>{{end}}
|
|
{{end}}
|
|
|
|
{{with $s.SourceURL}}<p class="muted small"><a href="{{.}}" rel="noreferrer">Kuuntele YouTubessa</a></p>{{end}}
|
|
|
|
{{if $s.ViewerReview}}
|
|
<section>
|
|
<h2>Oma arvostelusi</h2>
|
|
{{with $s.ViewerReview}}
|
|
{{if .CanEdit}}
|
|
<form method="post" action="/reviews/{{.ID}}" class="strip">
|
|
<input type="hidden" name="from" value="/songs/{{$s.ID}}">
|
|
{{template "fader" .Score}}
|
|
<div class="deck">
|
|
<label class="grow">Arvostelu
|
|
<textarea name="text" rows="6" maxlength="5000" required>{{.Text}}</textarea>
|
|
</label>
|
|
<div class="deckfoot">
|
|
<button type="submit">Päivitä</button>
|
|
<span class="muted small">Muokkausaika päättyy {{fidate .EditableUntil}}.</span>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<form method="post" action="/reviews/{{.ID}}/delete"
|
|
onsubmit="return confirm('Poistetaanko arvostelu?')">
|
|
<input type="hidden" name="from" value="/songs/{{$s.ID}}">
|
|
<button type="submit" class="ghost danger">Poista arvostelu</button>
|
|
</form>
|
|
{{else}}
|
|
<p class="score">{{.Score}}</p>
|
|
<p class="reviewtext">{{.Text}}</p>
|
|
<p class="muted small">Muokkausaika on päättynyt.</p>
|
|
{{end}}
|
|
{{end}}
|
|
</section>
|
|
{{end}}
|
|
|
|
<section>
|
|
<h2>Arvostelut{{if $s.ReviewCount}} ({{$s.ReviewCount}}){{end}}</h2>
|
|
|
|
{{if $s.Revealed}}
|
|
{{if $s.Reviews}}
|
|
<!-- One channel per reviewer: the spread across the row is what "divisive" looks like. -->
|
|
<div class="channels">
|
|
{{range $i, $r := $s.Reviews}}
|
|
<div class="chan{{if $r.Own}} own{{end}}" style="--v: {{$r.Score}}; --i: {{$i}}">
|
|
<span class="chan-track"><span class="chan-cap"></span></span>
|
|
<span class="chan-score">{{$r.Score}}</span>
|
|
<span class="chan-who" title="{{$r.Reviewer}}">{{$r.Initials}}</span>
|
|
</div>
|
|
{{end}}
|
|
{{if $s.Average}}
|
|
<div class="chan avg" style="--v: {{score $s.Average}}">
|
|
<span class="chan-track"><span class="chan-cap"></span></span>
|
|
<span class="chan-score">{{score $s.Average}}</span>
|
|
<span class="chan-who">ka.</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
|
|
{{range $s.Reviews}}
|
|
<article class="review{{if .Own}} own{{end}}">
|
|
<header>
|
|
<span class="avatar small">{{.Initials}}</span>
|
|
<span class="who">{{.Reviewer}}</span>
|
|
<span class="score">{{.Score}}</span>
|
|
<span class="meta">{{fidate .CreatedAt}}</span>
|
|
</header>
|
|
<p>{{.Text}}</p>
|
|
</article>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="muted">Kukaan ei ole vielä arvostellut tätä kappaletta.</p>
|
|
{{end}}
|
|
{{else}}
|
|
<p class="sealed-note">
|
|
<span class="sealed" aria-hidden="true"></span>
|
|
Muiden pisteet ja arvostelut paljastuvat kun kirjoitat omasi.
|
|
{{if $s.ReviewCount}}Arvosteluja on {{$s.ReviewCount}}.{{end}}
|
|
</p>
|
|
{{end}}
|
|
</section>
|
|
|
|
{{if $s.NextInQueue}}
|
|
<p class="nextup"><a href="/songs/{{$s.NextInQueue}}">Seuraava jonossa →</a></p>
|
|
{{end}}
|
|
{{end}}
|