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)
|
AnimeCharacters(anime)
|
||||||
AnimeRelations(anime, user)
|
AnimeRelations(anime, user)
|
||||||
AnimeTracks(anime, tracks)
|
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)
|
component AnimeSideColumn(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem, user *arn.User)
|
||||||
AnimeTrailer(anime)
|
AnimeTrailer(anime)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
@ -11,6 +12,7 @@ import (
|
|||||||
|
|
||||||
// Episodes ...
|
// Episodes ...
|
||||||
func Episodes(ctx *aero.Context) string {
|
func Episodes(ctx *aero.Context) string {
|
||||||
|
user := utils.GetUser(ctx)
|
||||||
id := ctx.Get("id")
|
id := ctx.Get("id")
|
||||||
|
|
||||||
anime, err := arn.GetAnime(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.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
|
if len(episodes) > 0
|
||||||
.anime-section.mountable
|
.anime-section.mountable
|
||||||
h3.anime-section-name Episodes
|
h3.anime-section-name Episodes
|
||||||
@ -14,12 +14,13 @@ component AnimeEpisodes(episodes []*arn.AnimeEpisode)
|
|||||||
Japanese(episode.Title.Japanese)
|
Japanese(episode.Title.Japanese)
|
||||||
else
|
else
|
||||||
span -
|
span -
|
||||||
td.episode-actions
|
if user != nil && user.Location.CountryName != "Japan"
|
||||||
for name, link := range episode.Links
|
td.episode-actions
|
||||||
a(href=link, target="_blank", rel="noopener", title="Watch episode " + toString(episode.Number) + " on " + name)
|
for name, link := range episode.Links
|
||||||
RawIcon("eye")
|
a(href=link, target="_blank", rel="noopener", title="Watch episode " + toString(episode.Number) + " on " + name)
|
||||||
//- a(href="https://translate.google.com/#ja/en/" + episode.Title.Japanese, target="_blank", rel="noopener")
|
RawIcon("eye")
|
||||||
//- RawIcon("google")
|
//- a(href="https://translate.google.com/#ja/en/" + episode.Title.Japanese, target="_blank", rel="noopener")
|
||||||
|
//- RawIcon("google")
|
||||||
if validator.IsValidDate(episode.AiringDate.Start)
|
if validator.IsValidDate(episode.AiringDate.Start)
|
||||||
td.episode-airing-date-start.utc-airing-date(data-start-date=episode.AiringDate.Start, data-end-date=episode.AiringDate.End, data-episode-number=episode.Number)= episode.AiringDate.StartDateHuman()
|
td.episode-airing-date-start.utc-airing-date(data-start-date=episode.AiringDate.Start, data-end-date=episode.AiringDate.End, data-episode-number=episode.Number)= episode.AiringDate.StartDateHuman()
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user