Tracks have permalinks now
This commit is contained in:
@ -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
|
||||
|
@ -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
21
pages/tracks/tracks.go
Normal 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
5
pages/tracks/tracks.pixy
Normal file
@ -0,0 +1,5 @@
|
||||
component Track(track *arn.SoundTrack)
|
||||
h2= track.Media[0].Title
|
||||
|
||||
.sound-tracks
|
||||
SoundTrackAllMedia(track)
|
Reference in New Issue
Block a user