Episode restrictions
This commit is contained in:
parent
cd9dfd85e1
commit
96b1e2d6d2
@ -28,7 +28,7 @@ component AnimeMainColumn(anime *arn.Anime, tracks []*arn.SoundTrack, episodes [
|
||||
AnimeCharacters(anime)
|
||||
AnimeRelations(anime, user)
|
||||
AnimeTracks(anime, tracks)
|
||||
AnimeEpisodes(episodes)
|
||||
AnimeEpisodes(episodes, user)
|
||||
|
||||
component AnimeSideColumn(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem, user *arn.User)
|
||||
AnimeTrailer(anime)
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
@ -11,6 +12,7 @@ import (
|
||||
|
||||
// Episodes ...
|
||||
func Episodes(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
id := ctx.Get("id")
|
||||
|
||||
anime, err := arn.GetAnime(id)
|
||||
@ -19,5 +21,5 @@ func Episodes(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime not found", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.AnimeEpisodes(anime.Episodes().Items))
|
||||
return ctx.HTML(components.AnimeEpisodes(anime.Episodes().Items, user))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
component AnimeEpisodes(episodes []*arn.AnimeEpisode)
|
||||
component AnimeEpisodes(episodes []*arn.AnimeEpisode, user *arn.User)
|
||||
if len(episodes) > 0
|
||||
.anime-section.mountable
|
||||
h3.anime-section-name Episodes
|
||||
@ -14,6 +14,7 @@ component AnimeEpisodes(episodes []*arn.AnimeEpisode)
|
||||
Japanese(episode.Title.Japanese)
|
||||
else
|
||||
span -
|
||||
if user != nil && user.Location.CountryName != "Japan"
|
||||
td.episode-actions
|
||||
for name, link := range episode.Links
|
||||
a(href=link, target="_blank", rel="noopener", title="Watch episode " + toString(episode.Number) + " on " + name)
|
||||
|
Loading…
Reference in New Issue
Block a user