29 lines
738 B
Go
Raw Normal View History

2017-10-09 13:47:40 +00:00
package soundtrack
import (
"net/http"
"github.com/animenotifier/notify.moe/components"
2019-06-01 04:55:49 +00:00
"github.com/animenotifier/notify.moe/middleware"
2017-10-10 10:14:52 +00:00
"github.com/animenotifier/notify.moe/utils"
2017-10-17 21:17:04 +00:00
"github.com/animenotifier/notify.moe/utils/editform"
2017-10-09 13:47:40 +00:00
"github.com/aerogo/aero"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2017-10-09 13:47:40 +00:00
)
// Edit track.
2019-06-01 04:55:49 +00:00
func Edit(ctx aero.Context) error {
2017-10-09 13:47:40 +00:00
id := ctx.Get("id")
track, err := arn.GetSoundTrack(id)
2017-10-17 09:43:07 +00:00
user := utils.GetUser(ctx)
2017-10-09 13:47:40 +00:00
if err != nil {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
2019-06-01 04:55:49 +00:00
customCtx := ctx.(*middleware.OpenGraphContext)
2019-09-01 00:56:40 +00:00
customCtx.OpenGraph = getOpenGraph(track)
2017-11-05 18:54:58 +00:00
return ctx.HTML(components.SoundTrackTabs(track, user) + editform.Render(track, "Edit soundtrack", user))
2017-10-09 13:47:40 +00:00
}