Display latest anime trailer on an anime page.

This commit is contained in:
Scott 2018-06-30 13:02:30 +02:00 committed by Soulcramer
parent 027fea7836
commit 770f5bae5f

View File

@ -150,11 +150,14 @@ component AnimeGenres(anime *arn.Anime)
span= genre
component AnimeTrailer(anime *arn.Anime)
if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].ServiceID != ""
if len(anime.Trailers) > 0 && anime.Trailers[len(anime.Trailers) - 1].Service == "Youtube" && anime.Trailers[len(anime.Trailers) - 1].ServiceID != ""
AnimeTrailerByIndex(anime, len(anime.Trailers)-1)
component AnimeTrailerByIndex(anime *arn.Anime, index int)
section.anime-section.mountable
h3.anime-section-name Trailer
.anime-trailer.video-container
iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[0].ServiceID + "?showinfo=0", allowfullscreen="allowfullscreen")
iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[index].ServiceID + "?showinfo=0", allowfullscreen="allowfullscreen")
component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem)
if len(friends) > 0