Tracks have permalinks now

This commit is contained in:
2017-06-28 00:16:45 +02:00
parent 5099c0b0e7
commit d5dcd9c909
9 changed files with 89 additions and 12 deletions

View File

@ -34,10 +34,10 @@ component Dashboard(posts []*arn.Post, soundTracks []*arn.SoundTrack, following
for i := 0; i <= 4; i++
if i < len(soundTracks)
a.widget-element.ajax(href="/music")
a.widget-element.ajax(href=soundTracks[i].Link())
.widget-element-text
Icon("music")
span= soundTracks[i].MainAnime().Title.Canonical
span= soundTracks[i].Media[0].Title
else
.widget-element
.widget-element-text

View File

@ -1,6 +1,8 @@
package posts
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
@ -12,7 +14,7 @@ func Get(ctx *aero.Context) string {
post, err := arn.GetPost(id)
if err != nil {
return ctx.Error(404, "Post not found", err)
return ctx.Error(http.StatusNotFound, "Post not found", err)
}
return ctx.HTML(components.Post(post))

21
pages/tracks/tracks.go Normal file
View File

@ -0,0 +1,21 @@
package tracks
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
// Get post.
func Get(ctx *aero.Context) string {
id := ctx.Get("id")
track, err := arn.GetSoundTrack(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
return ctx.HTML(components.Track(track))
}

5
pages/tracks/tracks.pixy Normal file
View File

@ -0,0 +1,5 @@
component Track(track *arn.SoundTrack)
h2= track.Media[0].Title
.sound-tracks
SoundTrackAllMedia(track)