Added soundtrack drafts
This commit is contained in:
@ -6,12 +6,15 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxTracks = 9
|
||||
|
||||
// Get renders the soundtracks page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
tracks, err := arn.FilterSoundTracks(func(track *arn.SoundTrack) bool {
|
||||
return !track.IsDraft && len(track.Media) > 0
|
||||
})
|
||||
@ -26,5 +29,5 @@ func Get(ctx *aero.Context) string {
|
||||
tracks = tracks[:maxTracks]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.SoundTracks(tracks))
|
||||
return ctx.HTML(components.SoundTracks(tracks, user))
|
||||
}
|
||||
|
@ -1,10 +1,16 @@
|
||||
component SoundTracks(tracks []*arn.SoundTrack)
|
||||
component SoundTracks(tracks []*arn.SoundTrack, user *arn.User)
|
||||
h1 Soundtracks
|
||||
|
||||
.music-buttons
|
||||
a.button.action(data-action="newSoundTrack", data-trigger="click")
|
||||
Icon("plus")
|
||||
span Add soundtrack
|
||||
if user != nil
|
||||
if user.DraftIndex().SoundTrackID == ""
|
||||
button.action(data-action="newSoundTrack", data-trigger="click")
|
||||
Icon("plus")
|
||||
span Add soundtrack
|
||||
else
|
||||
a.button.ajax(href="/soundtrack/" + user.DraftIndex().SoundTrackID + "/edit")
|
||||
Icon("pencil")
|
||||
span Edit draft
|
||||
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
|
Reference in New Issue
Block a user