Merge pull request #165 from soulcramer/show_latest_anime_trailer

Display latest anime trailer on an anime page.
This commit is contained in:
Eduard Urbach 2018-06-30 20:11:53 +09:00 committed by GitHub
commit c4d2880fb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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(data-mountable-type="sidebar")
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