Added basic AMV routes

This commit is contained in:
2018-04-14 23:23:00 +02:00
parent 854833c586
commit d19542b5aa
6 changed files with 65 additions and 3 deletions

View File

@ -2,9 +2,20 @@ package amvs
import (
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get AMVs.
func Get(ctx *aero.Context) string {
return ctx.HTML("Coming soon™.")
// Latest AMVs.
func Latest(ctx *aero.Context) string {
user := utils.GetUser(ctx)
return ctx.HTML(components.AMVs(nil, -1, "", user))
}
// Best AMVs.
func Best(ctx *aero.Context) string {
user := utils.GetUser(ctx)
return ctx.HTML(components.AMVs(nil, -1, "", user))
}

32
pages/amvs/amvs.pixy Normal file
View File

@ -0,0 +1,32 @@
component AMVs(amvs []*arn.AMV, nextIndex int, tag string, user *arn.User)
h1.page-title AMVs
AMVsTabs(tag)
.corner-buttons
if user != nil
if user.DraftIndex().AMVID == ""
button.action(data-action="newObject", data-trigger="click", data-type="amv")
Icon("plus")
span Add AMV
else
a.button(href="/amv/" + user.DraftIndex().AMVID + "/edit")
Icon("pencil")
span Edit draft
#load-more-target.amvs
AMVsScrollable(amvs, user)
if nextIndex != -1
.buttons
LoadMore(nextIndex)
component AMVsScrollable(amvs []*arn.AMV, user *arn.User)
each amv in amvs
AMV(amv, user)
component AMVsTabs(tag string)
.tab-groups
.tabs
Tab("Latest", "video-camera", "/amvs")
Tab("Best", "heart", "/amvs/best")