Improved music page

This commit is contained in:
Eduard Urbach 2017-06-27 14:01:32 +02:00
parent cc2e0c63ea
commit 976c964559
3 changed files with 28 additions and 7 deletions

View File

@ -1,8 +1,12 @@
package music package music
import "github.com/aerogo/aero" import (
import "github.com/animenotifier/notify.moe/components" "sort"
import "github.com/animenotifier/arn"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get renders the music page. // Get renders the music page.
func Get(ctx *aero.Context) string { func Get(ctx *aero.Context) string {
@ -19,6 +23,8 @@ func Get(ctx *aero.Context) string {
Tags: []string{ Tags: []string{
"anime:7622", "anime:7622",
}, },
Created: arn.DateTimeUTC(),
CreatedBy: "4J6qpK1ve",
}) })
tracks = append(tracks, &arn.SoundTrack{ tracks = append(tracks, &arn.SoundTrack{
@ -32,6 +38,12 @@ func Get(ctx *aero.Context) string {
Tags: []string{ Tags: []string{
"anime:11469", "anime:11469",
}, },
Created: arn.DateTimeUTC(),
CreatedBy: "4J6qpK1ve",
})
sort.Slice(tracks, func(i, j int) bool {
return tracks[i].Created > tracks[j].Created
}) })
return ctx.HTML(components.Music(tracks)) return ctx.HTML(components.Music(tracks))

View File

@ -4,8 +4,10 @@ component Music(tracks []*arn.SoundTrack)
.sound-tracks .sound-tracks
each track in tracks each track in tracks
.sound-track .sound-track
each anime in track.Anime() a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
a.sound-track-anime-link.ajax(href="/anime/" + anime.ID) img.sound-track-anime-image(src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
img.sound-track-anime-image(src=anime.Image.Small, alt=anime.Title.Canonical, title=anime.Title.Canonical)
iframe(src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true") iframe(src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true")
.sound-track-footer
span posted by
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick

View File

@ -3,11 +3,18 @@
.sound-track .sound-track
horizontal horizontal
margin-bottom 1rem
iframe iframe
width 100% width 100%
.sound-track-footer
text-align right
margin-bottom content-padding
font-size 0.9em
span
opacity 0.65
.sound-track-anime-link .sound-track-anime-link
// //