mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-31 16:09:39 +05:00
62 lines
1.6 KiB
Plaintext
62 lines
1.6 KiB
Plaintext
package templates
|
|
|
|
import (
|
|
"github.com/maid-zone/soundcloak/lib/sc"
|
|
"net/url"
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
templ PlaylistEmbed(p sc.Playlist) {
|
|
<meta name="og:site_name" content={ p.Author.Username + " ~ soundcloak" }/>
|
|
<meta name="og:title" content={ p.Title }/>
|
|
<meta name="og:description" content={ p.FormatDescription() }/>
|
|
<meta name="og:image" content={ p.Artwork }/>
|
|
<link rel="icon" type="image/x-icon" href={ p.Artwork }/>
|
|
}
|
|
|
|
templ Playlist(p sc.Playlist) {
|
|
if p.Artwork != "" {
|
|
<img src={ p.Artwork }/>
|
|
}
|
|
<h1>{ p.Title }</h1>
|
|
<a class="listing" href={ templ.URL("/" + p.Author.Permalink) }>
|
|
<img src={ p.Author.Avatar }/>
|
|
<div class="meta">
|
|
<h3>{ p.Author.Username }</h3>
|
|
if p.Author.FullName != "" {
|
|
<span>{ p.Author.FullName }</span>
|
|
}
|
|
</div>
|
|
</a>
|
|
<p style="white-space: pre-wrap">{ p.Description }</p>
|
|
<span>{ strconv.FormatInt(p.TrackCount, 10) } tracks</span>
|
|
<br/>
|
|
<br/>
|
|
<div>
|
|
for _, track := range p.Tracks {
|
|
if track.Title != "" {
|
|
<a class="listing" href={ templ.URL("/" + track.Author.Permalink + "/" + track.Permalink) }>
|
|
<img src={ track.Artwork }/>
|
|
<div class="meta">
|
|
<h3>{ track.Title }</h3>
|
|
<span>{ track.Author.Username }</span>
|
|
</div>
|
|
</a>
|
|
}
|
|
}
|
|
</div>
|
|
if len(p.MissingTracks) != 0 {
|
|
<a href={ templ.URL("?pagination=" + url.QueryEscape(p.MissingTracks)) } rel="noreferrer">more tracks</a>
|
|
}
|
|
<div>
|
|
if p.TagList != "" {
|
|
<p>Tags: { strings.Join(sc.TagListParser(p.TagList), ", ") }</p>
|
|
}
|
|
<p>{ strconv.FormatInt(p.Likes, 10) } likes</p>
|
|
<br/>
|
|
<p>Created: { p.CreatedAt }</p>
|
|
<p>Last modified: { p.LastModified }</p>
|
|
</div>
|
|
}
|