Merge pull request #174 from Amatrelan/arrows
Episode left and right arrow #153
This commit is contained in:
commit
ec9bd057ef
@ -33,11 +33,11 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episodes not found", err)
|
||||
}
|
||||
|
||||
episode := animeEpisodes.Find(episodeNumber)
|
||||
episode, episodeIndex := animeEpisodes.Find(episodeNumber)
|
||||
|
||||
if episode == nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episode not found")
|
||||
}
|
||||
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, user))
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, user, episodeIndex))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, user *arn.User)
|
||||
component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, user *arn.User, episodeIndex int)
|
||||
h1
|
||||
a(href=anime.Link())= anime.Title.ByUser(user)
|
||||
|
||||
@ -8,6 +8,14 @@ component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, user *arn.Us
|
||||
|
||||
h3.episode-view-number= "Episode " + strconv.Itoa(episode.Number)
|
||||
|
||||
//- if episodeIndex > 0
|
||||
//- a.button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex - 1].Number))
|
||||
//- Icon("chevron-left")
|
||||
|
||||
//- if episodeIndex < len(anime.Episodes().Items) - 1
|
||||
//- a.button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex + 1].Number))
|
||||
//- Icon("chevron-right")
|
||||
|
||||
if episode.Title.Japanese != ""
|
||||
.episode-view-title
|
||||
Japanese(episode.Title.Japanese)
|
||||
|
Loading…
Reference in New Issue
Block a user