Improved music page
This commit is contained in:
parent
cc2e0c63ea
commit
976c964559
@ -1,8 +1,12 @@
|
||||
package music
|
||||
|
||||
import "github.com/aerogo/aero"
|
||||
import "github.com/animenotifier/notify.moe/components"
|
||||
import "github.com/animenotifier/arn"
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
// Get renders the music page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
@ -19,6 +23,8 @@ func Get(ctx *aero.Context) string {
|
||||
Tags: []string{
|
||||
"anime:7622",
|
||||
},
|
||||
Created: arn.DateTimeUTC(),
|
||||
CreatedBy: "4J6qpK1ve",
|
||||
})
|
||||
|
||||
tracks = append(tracks, &arn.SoundTrack{
|
||||
@ -32,6 +38,12 @@ func Get(ctx *aero.Context) string {
|
||||
Tags: []string{
|
||||
"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))
|
||||
|
@ -4,8 +4,10 @@ component Music(tracks []*arn.SoundTrack)
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
.sound-track
|
||||
each anime in track.Anime()
|
||||
a.sound-track-anime-link.ajax(href="/anime/" + anime.ID)
|
||||
img.sound-track-anime-image(src=anime.Image.Small, alt=anime.Title.Canonical, title=anime.Title.Canonical)
|
||||
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
|
||||
img.sound-track-anime-image(src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().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")
|
||||
.sound-track-footer
|
||||
span posted by
|
||||
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick
|
@ -3,11 +3,18 @@
|
||||
|
||||
.sound-track
|
||||
horizontal
|
||||
margin-bottom 1rem
|
||||
|
||||
iframe
|
||||
width 100%
|
||||
|
||||
.sound-track-footer
|
||||
text-align right
|
||||
margin-bottom content-padding
|
||||
font-size 0.9em
|
||||
|
||||
span
|
||||
opacity 0.65
|
||||
|
||||
.sound-track-anime-link
|
||||
//
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user