Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
✨ Added anime trailers page.
Browse files Browse the repository at this point in the history
  • Loading branch information
soulcramer committed Oct 10, 2018
1 parent 9f8f19c commit 5460c49
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pages/anime/trailers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package anime

import (
"net/http"

"github.com/animenotifier/notify.moe/utils"

"github.com/animenotifier/notify.moe/components"

"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)

// Trailers Display the trailers of an anime.
func Trailers(ctx *aero.Context) string {
id := ctx.Get("id")
user := utils.GetUser(ctx)
anime, err := arn.GetAnime(id)

if err != nil {
return ctx.Error(http.StatusNotFound, "Anime not found", err)
}

return ctx.HTML(components.AnimeTrailers(anime, user))
}
13 changes: 13 additions & 0 deletions pages/anime/trailers.pixy
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
component AnimeTrailers(anime *arn.Anime, user *arn.User)
if anime.Trailers != nil && len(anime.Trailers) > 0
.anime-section.mountable
h3.anime-section-name
a(href=anime.TrailersLink()) Trailers

.trailers.anime-trailers
each trailer in anime.Trailers
if trailer.ServiceID != ""
.trailer.mountable(data-mountable-type="trailer")
.anime-trailer.video-container
//iframe.video(src="https://www.youtube.com/embed/" + trailer.ServiceID + "?showinfo=0", allowfullscreen)
ExternalMedia(trailer)
27 changes: 27 additions & 0 deletions pages/anime/trailers.scarlet
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.anime-trailers
vertical
.trailer
margin 1rem 0
border-bottom-left-radius ui-element-border-radius !important
border-top-left-radius ui-element-border-radius !important
box-shadow shadow-light
min-height 200px
border-radius ui-element-border-radius
overflow hidden

iframe
width 100%

>
500px
.anime-trailers
horizontal-wrap
justify-content flex-start

.trailer
max-width 200px
margin calc(content-padding / 2)
min-height 112px
height 112px
margin soundtrack-margin
margin-bottom media-bottom-margin
1 change: 1 addition & 0 deletions pages/index/animeroutes/animeroutes.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func Register(l *layout.Layout) {
l.Page("/anime/:id", anime.Get)
l.Page("/anime/:id/episodes", anime.Episodes)
l.Page("/anime/:id/characters", anime.Characters)
l.Page("/anime/:id/trailers", anime.Trailers)
l.Page("/anime/:id/tracks", anime.Tracks)
l.Page("/anime/:id/relations", anime.Relations)
l.Page("/anime/:id/episode/:episode-number", episode.Get)
Expand Down

0 comments on commit 5460c49

Please sign in to comment.