2019-09-01 09:56:40 +09:00

29 lines
738 B
Go

package soundtrack
import (
"net/http"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/middleware"
"github.com/animenotifier/notify.moe/utils"
"github.com/animenotifier/notify.moe/utils/editform"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/arn"
)
// Edit track.
func Edit(ctx aero.Context) error {
id := ctx.Get("id")
track, err := arn.GetSoundTrack(id)
user := utils.GetUser(ctx)
if err != nil {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = getOpenGraph(track)
return ctx.HTML(components.SoundTrackTabs(track, user) + editform.Render(track, "Edit soundtrack", user))
}