Added anime comments

This commit is contained in:
Eduard Urbach 2018-11-01 14:45:16 +09:00
parent 3ad4faf38a
commit 5866683811
7 changed files with 46 additions and 2 deletions

View File

@ -30,6 +30,7 @@ component AnimeMainColumn(anime *arn.Anime, listItem *arn.AnimeListItem, tracks
AnimeTracks(anime, tracks, user, false)
AnimeAMVs(anime, amvs, amvAppearances, user)
AnimeEpisodes(anime, episodes, user, false)
AnimeComments(anime, user, false)
component AnimeSideColumn(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem, user *arn.User)
AnimeTrailer(anime)

24
pages/anime/comments.go Normal file
View File

@ -0,0 +1,24 @@
package anime
import (
"net/http"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// Comments ...
func Comments(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Anime not found", err)
}
return ctx.HTML(components.AnimeComments(anime, user, true))
}

12
pages/anime/comments.pixy Normal file
View File

@ -0,0 +1,12 @@
component AnimeComments(anime *arn.Anime, user *arn.User, standAlonePage bool)
if standAlonePage
h1.mountable
a(href=anime.Link())= anime.Title.ByUser(user)
section.anime-section.mountable
if !standAlonePage
h3.anime-section-name
a(href=anime.Link() + "/comments") Comments
.anime-comments(data-standalone-page=standAlonePage)
Comments(anime, user)

View File

@ -0,0 +1,7 @@
.anime-comments
[data-standalone-page="false"]
margin-top 1rem
.thread
max-width 600px
justify-content flex-start

View File

@ -14,7 +14,6 @@ import (
func Episodes(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
anime, err := arn.GetAnime(id)
if err != nil {

View File

@ -17,6 +17,7 @@ func Register(l *layout.Layout) {
l.Page("/anime/:id/characters", anime.Characters)
l.Page("/anime/:id/tracks", anime.Tracks)
l.Page("/anime/:id/relations", anime.Relations)
l.Page("/anime/:id/comments", anime.Comments)
l.Page("/anime/:id/episode/:episode-number", episode.Get)
// Anime redirects

View File

@ -465,7 +465,7 @@ var routeTests = map[string][]string{
"/settings/apps": nil,
"/settings/avatar": nil,
"/settings/formatting": nil,
"/settings/pro": nil,
"/settings/extras": nil,
"/shop": nil,
"/shop/history": nil,
"/support": nil,