mirror of
https://github.com/riwiwa/muzi.git
synced 2026-04-20 11:25:51 -07:00
Add search and pages for tracks, albums, and artists
This commit is contained in:
58
templates/album.gohtml
Normal file
58
templates/album.gohtml
Normal file
@@ -0,0 +1,58 @@
|
||||
{{define "album"}}
|
||||
<div class="profile-top">
|
||||
{{if .Album.CoverUrl}}
|
||||
<img src="{{.Album.CoverUrl}}" alt="{{.Album.Title}}'s cover">
|
||||
{{else}}
|
||||
<img src="/files/assets/pfps/default.png" alt="{{.Album.Title}}'s cover">
|
||||
{{end}}
|
||||
<div class="username-bio">
|
||||
<h1>{{.Album.Title}}</h1>
|
||||
{{if .Artist.Name}}
|
||||
<h2><a href="/profile/{{.Username}}/artist/{{urlquery .Artist.Name}}">{{.Artist.Name}}</a></h2>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="profile-top-blank">
|
||||
</div>
|
||||
<div class="user-stats-top">
|
||||
<h3>{{formatInt .ListenCount}}</h3> <p>Listens<p>
|
||||
</div>
|
||||
</div>
|
||||
{{if eq .LoggedInUsername .Username}}
|
||||
<div class="edit-section">
|
||||
<h3>Edit Album</h3>
|
||||
<form method="POST" action="/profile/{{.Username}}/album/{{.Album.Id}}/edit">
|
||||
<label>Title: <input type="text" name="title" value="{{.Album.Title}}"></label>
|
||||
<label>Cover URL: <input type="text" name="cover_url" value="{{.Album.CoverUrl}}"></label>
|
||||
<label>Spotify ID: <input type="text" name="spotify_id" value="{{.Album.SpotifyId}}"></label>
|
||||
<label>MusicBrainz ID: <input type="text" name="musicbrainz_id" value="{{.Album.MusicbrainzId}}"></label>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="history">
|
||||
<h3>Scrobbles</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<th>Title</th>
|
||||
<th>Album</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
{{$username := .Username}}
|
||||
{{range .Times}}
|
||||
<tr>
|
||||
<td><a href="/profile/{{$username}}/artist/{{urlquery .ArtistName}}">{{.ArtistName}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/song/{{urlquery .SongName}}">{{.SongName}}</a></td>
|
||||
<td>{{.AlbumName}}</td>
|
||||
<td title="{{formatTimestampFull .Timestamp}}">{{formatTimestamp .Timestamp}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
</div>
|
||||
<div class="page_buttons">
|
||||
{{if gt .Page 1 }}
|
||||
<a href="/profile/{{.Username}}/album/{{urlquery .Album.Title}}?page={{sub .Page 1}}">Prev Page</a>
|
||||
{{end}}
|
||||
<a href="/profile/{{.Username}}/album/{{urlquery .Album.Title}}?page={{add .Page 1}}">Next Page</a>
|
||||
</div>
|
||||
{{end}}
|
||||
57
templates/artist.gohtml
Normal file
57
templates/artist.gohtml
Normal file
@@ -0,0 +1,57 @@
|
||||
{{define "artist"}}
|
||||
<div class="profile-top">
|
||||
{{if .Artist.ImageUrl}}
|
||||
<img src="{{.Artist.ImageUrl}}" alt="{{.Artist.Name}}'s image">
|
||||
{{else}}
|
||||
<img src="/files/assets/pfps/default_artist.png" alt="{{.Artist.Name}}'s image">
|
||||
{{end}}
|
||||
<div class="username-bio">
|
||||
<h1>{{.Artist.Name}}</h1>
|
||||
<h2>{{.Artist.Bio}}</h2>
|
||||
</div>
|
||||
<div class="profile-top-blank">
|
||||
</div>
|
||||
<div class="user-stats-top">
|
||||
<h3>{{formatInt .ListenCount}}</h3> <p>Listens<p>
|
||||
</div>
|
||||
</div>
|
||||
{{if eq .LoggedInUsername .Username}}
|
||||
<div class="edit-section">
|
||||
<h3>Edit Artist</h3>
|
||||
<form method="POST" action="/profile/{{.Username}}/artist/{{.Artist.Id}}/edit">
|
||||
<label>Name: <input type="text" name="name" value="{{.Artist.Name}}"></label>
|
||||
<label>Image URL: <input type="text" name="image_url" value="{{.Artist.ImageUrl}}"></label>
|
||||
<label>Bio: <textarea name="bio">{{.Artist.Bio}}</textarea></label>
|
||||
<label>Spotify ID: <input type="text" name="spotify_id" value="{{.Artist.SpotifyId}}"></label>
|
||||
<label>MusicBrainz ID: <input type="text" name="musicbrainz_id" value="{{.Artist.MusicbrainzId}}"></label>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="history">
|
||||
<h3>Scrobbles</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<th>Title</th>
|
||||
<th>Album</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
{{$username := .Username}}
|
||||
{{range .Times}}
|
||||
<tr>
|
||||
<td><a href="/profile/{{$username}}/artist/{{urlquery .ArtistName}}">{{.ArtistName}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/song/{{urlquery .SongName}}">{{.SongName}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/album/{{urlquery .AlbumName}}">{{.AlbumName}}</a></td>
|
||||
<td title="{{formatTimestampFull .Timestamp}}">{{formatTimestamp .Timestamp}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
</div>
|
||||
<div class="page_buttons">
|
||||
{{if gt .Page 1 }}
|
||||
<a href="/profile/{{.Username}}/artist/{{urlquery .Artist.Name}}?page={{sub .Page 1}}">Prev Page</a>
|
||||
{{end}}
|
||||
<a href="/profile/{{.Username}}/artist/{{urlquery .Artist.Name}}?page={{add .Page 1}}">Next Page</a>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -13,6 +13,12 @@
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
|
||||
<!-- Search Bar -->
|
||||
<div class="search-container">
|
||||
<input type="text" id="globalSearch" placeholder="Search artists, songs, albums..." autocomplete="off">
|
||||
<div id="searchResults" class="search-results"></div>
|
||||
</div>
|
||||
|
||||
<!-- Slide-out Menu -->
|
||||
<div class="side-menu" id="sideMenu">
|
||||
@@ -44,6 +50,9 @@
|
||||
<!-- Main Content -->
|
||||
{{ if eq .TemplateName "profile"}}{{block "profile" .}}{{end}}{{end}}
|
||||
{{ if eq .TemplateName "settings"}}{{block "settings" .}}{{end}}{{end}}
|
||||
{{ if eq .TemplateName "artist"}}{{block "artist" .}}{{end}}{{end}}
|
||||
{{ if eq .TemplateName "song"}}{{block "song" .}}{{end}}{{end}}
|
||||
{{ if eq .TemplateName "album"}}{{block "album" .}}{{end}}{{end}}
|
||||
|
||||
<script src="/files/menu.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
</div>
|
||||
<div class="profile-top-blank">
|
||||
</div>
|
||||
<div class="user-stats-top">
|
||||
<h3>{{formatInt .ScrobbleCount}}</h3> <p>Listens<p>
|
||||
<h3>{{formatInt .ArtistCount}}</h3> <p>Artists<p>
|
||||
</div>
|
||||
<div class="user-stats-top">
|
||||
<h3>{{formatInt .ScrobbleCount}}</h3> <p>Listens<p>
|
||||
<h3>{{formatInt .ArtistCount}}</h3> <p>Artists<p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="history">
|
||||
<h3>Listening History</h3>
|
||||
@@ -29,10 +29,11 @@
|
||||
{{end}}
|
||||
{{$artists := .Artists}}
|
||||
{{$times := .Times}}
|
||||
{{$username := .Username}}
|
||||
{{range $index, $title := .Titles}}
|
||||
<tr>
|
||||
<td>{{index $artists $index}}</td>
|
||||
<td>{{$title}}</td>
|
||||
<td><a href="/profile/{{$username}}/artist/{{urlquery (index $artists $index)}}">{{index $artists $index}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/song/{{urlquery $title}}">{{$title}}</a></td>
|
||||
<td title="{{formatTimestampFull (index $times $index)}}">{{formatTimestamp (index $times $index)}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
|
||||
55
templates/song.gohtml
Normal file
55
templates/song.gohtml
Normal file
@@ -0,0 +1,55 @@
|
||||
{{define "song"}}
|
||||
<div class="profile-top">
|
||||
<div class="username-bio">
|
||||
<h1>{{.Song.Title}}</h1>
|
||||
{{if .Artist.Name}}
|
||||
<h2><a href="/profile/{{.Username}}/artist/{{urlquery .Artist.Name}}">{{.Artist.Name}}</a></h2>
|
||||
{{end}}
|
||||
{{if .Album.Title}}
|
||||
<h3><a href="/profile/{{.Username}}/album/{{urlquery .Album.Title}}">{{.Album.Title}}</a></h3>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="profile-top-blank">
|
||||
</div>
|
||||
<div class="user-stats-top">
|
||||
<h3>{{formatInt .ListenCount}}</h3> <p>Listens<p>
|
||||
</div>
|
||||
</div>
|
||||
{{if eq .LoggedInUsername .Username}}
|
||||
<div class="edit-section">
|
||||
<h3>Edit Song</h3>
|
||||
<form method="POST" action="/profile/{{.Username}}/song/{{.Song.Id}}/edit">
|
||||
<label>Title: <input type="text" name="title" value="{{.Song.Title}}"></label>
|
||||
<label>Spotify ID: <input type="text" name="spotify_id" value="{{.Song.SpotifyId}}"></label>
|
||||
<label>MusicBrainz ID: <input type="text" name="musicbrainz_id" value="{{.Song.MusicbrainzId}}"></label>
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="history">
|
||||
<h3>Scrobbles</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<th>Title</th>
|
||||
<th>Album</th>
|
||||
<th>Timestamp</th>
|
||||
</tr>
|
||||
{{$username := .Username}}
|
||||
{{range .Times}}
|
||||
<tr>
|
||||
<td><a href="/profile/{{$username}}/artist/{{urlquery .ArtistName}}">{{.ArtistName}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/song/{{urlquery .SongName}}">{{.SongName}}</a></td>
|
||||
<td><a href="/profile/{{$username}}/album/{{urlquery .AlbumName}}">{{.AlbumName}}</a></td>
|
||||
<td title="{{formatTimestampFull .Timestamp}}">{{formatTimestamp .Timestamp}}</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</table>
|
||||
</div>
|
||||
<div class="page_buttons">
|
||||
{{if gt .Page 1 }}
|
||||
<a href="/profile/{{.Username}}/song/{{urlquery .Song.Title}}?page={{sub .Page 1}}">Prev Page</a>
|
||||
{{end}}
|
||||
<a href="/profile/{{.Username}}/song/{{urlquery .Song.Title}}?page={{add .Page 1}}">Next Page</a>
|
||||
</div>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user