This commit is contained in:
2017-10-02 06:29:58 +02:00
parent 4e5472260d
commit 93ed7378ae
9 changed files with 18 additions and 7 deletions

View File

@ -0,0 +1,28 @@
package soundtracks
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxTracks = 9
// Get renders the music page.
func Get(ctx *aero.Context) string {
tracks, err := arn.AllSoundTracks()
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Error fetching soundtracks", err)
}
arn.SortSoundTracksLatestFirst(tracks)
if len(tracks) > maxTracks {
tracks = tracks[:maxTracks]
}
return ctx.HTML(components.Music(tracks))
}

View File

@ -0,0 +1,11 @@
component Music(tracks []*arn.SoundTrack)
h1 Soundtracks
.music-buttons
a.button.ajax(href="/new/soundtrack")
Icon("plus")
span Add soundtrack
.sound-tracks
each track in tracks
SoundTrack(track)

View File

@ -0,0 +1,42 @@
.sound-tracks
horizontal-wrap
justify-content space-around
.sound-track
vertical
flex 1
flex-basis 500px
padding 1rem
.sound-track-content
horizontal
iframe
width 100%
box-shadow shadow-light
.sound-track-footer
text-align right
margin-bottom 1rem
font-size 0.9em
span
opacity 0.65
.sound-track-anime-link
display none
> 800px
.sound-track-anime-link
display block
.sound-track-anime-image
max-width 142px
> 600px
.music-buttons
position absolute
top content-padding
right content-padding