226 lines
7.8 KiB
Plaintext
Raw Normal View History

2017-11-05 08:32:46 +00:00
component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, episodes []*arn.AnimeEpisode, friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem, user *arn.User)
2017-11-03 17:10:31 +00:00
.anime
2017-11-04 07:45:39 +00:00
.anime-main-column
2017-11-05 08:32:46 +00:00
AnimeMainColumn(anime, tracks, episodes, user)
2017-11-04 07:45:39 +00:00
.anime-side-column
AnimeSideColumn(anime, friends, listItems, user)
2017-11-05 08:32:46 +00:00
component AnimeMainColumn(anime *arn.Anime, tracks []*arn.SoundTrack, episodes []*arn.AnimeEpisode, user *arn.User)
2017-11-04 07:45:39 +00:00
.anime-header(data-id=anime.ID)
2017-11-09 17:10:10 +00:00
.anime-image-container.mountable
img.anime-cover-image.lazy(data-src=anime.Image("large"), data-webp="true", alt=anime.Title.ByUser(user))
//- if anime.StartDate != ""
//- .anime-start-date
//- span(title="Start date: " + anime.StartDate)= anime.StartDate[:4]
//- if anime.EndDate != "" && anime.StartDate[:4] != anime.EndDate[:4]
//- span -
//- span(title="End date: " + anime.EndDate)= anime.EndDate[:4]
2017-11-04 07:45:39 +00:00
.space
.anime-info
h1.anime-title.mountable(title=anime.Type)= anime.Title.ByUser(user)
h2.anime-alternative-title.mountable
Japanese(anime.Title.Japanese)
//- h3.anime-section-name.anime-summary-header Summary
p.anime-summary.mountable= anime.Summary
2017-11-09 17:10:10 +00:00
2017-11-05 10:02:31 +00:00
AnimeActions(anime, user)
2017-11-09 17:10:10 +00:00
2017-11-05 08:55:42 +00:00
AnimeCharacters(anime)
AnimeRelations(anime, user)
AnimeTracks(anime, tracks)
AnimeEpisodes(episodes)
2017-11-09 17:10:10 +00:00
2017-11-05 08:55:42 +00:00
//- //- h3.anime-section-name Reviews
//- //- p Coming soon.
//- .footer
//- span Powered by Kitsu.
component AnimeSideColumn(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem, user *arn.User)
AnimeTrailer(anime)
AnimeInformation(anime)
AnimeRatings(anime, user)
AnimePopularity(anime)
AnimeFriends(friends, listItems)
AnimeLinks(anime)
component AnimeActions(anime *arn.Anime, user *arn.User)
2017-11-04 07:45:39 +00:00
if user != nil
2017-11-05 10:02:31 +00:00
.buttons.anime-actions.mountable
if user.Role == "editor" || user.Role == "admin"
a.button.ajax(href=anime.Link() + "/edit")
Icon("pencil-square-o")
span Edit anime
2017-11-04 07:45:39 +00:00
if user.AnimeList().Contains(anime.ID)
a.button.ajax(href="/+" + user.Nick + "/animelist/anime/" + anime.ID)
Icon("pencil")
span Edit in collection
else
button.action(data-api="/api/animelist/" + user.ID, data-action="addAnimeToCollection", data-trigger="click", data-anime-id=anime.ID)
Icon("plus")
span Add to collection
2017-11-04 10:09:19 +00:00
component AnimeRatings(anime *arn.Anime, user *arn.User)
section.anime-section.mountable
h3.anime-section-name Ratings
table.anime-info-table
tr.mountable(data-mountable-type="info")
td.anime-info-key
if anime.Status == "upcoming"
span Hype:
else
span Overall:
td.anime-info-value
Rating(anime.Rating.Overall, user)
if anime.Rating.Story > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Story:
td.anime-info-value
Rating(anime.Rating.Story, user)
if anime.Rating.Visuals > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Visuals:
td.anime-info-value
Rating(anime.Rating.Visuals, user)
if anime.Rating.Soundtrack > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Soundtrack:
td.anime-info-value
Rating(anime.Rating.Soundtrack, user)
component AnimePopularity(anime *arn.Anime)
if anime.Popularity.Total() > 0
section.anime-section.mountable
h3.anime-section-name Popularity
table.anime-info-table
if anime.Popularity.Watching > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Watching:
td.anime-info-value= anime.Popularity.Watching
if anime.Popularity.Completed > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Completed:
td.anime-info-value= anime.Popularity.Completed
2017-11-09 17:10:10 +00:00
2017-11-04 10:09:19 +00:00
if anime.Popularity.Planned > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Planned:
td.anime-info-value= anime.Popularity.Planned
if anime.Popularity.Hold > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key On hold:
td.anime-info-value= anime.Popularity.Hold
if anime.Popularity.Dropped > 0
tr.mountable(data-mountable-type="info")
td.anime-info-key Dropped:
td.anime-info-value= anime.Popularity.Dropped
component AnimeLinks(anime *arn.Anime)
section.anime-section.mountable
h3.anime-section-name Links
.light-button-group
a.light-button(href="https://kitsu.io/anime/" + anime.ID, target="_blank", rel="noopener")
Icon("external-link")
span Kitsu
2017-11-09 17:10:10 +00:00
2017-11-04 10:09:19 +00:00
each mapping in anime.Mappings
a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
Icon("external-link")
span= mapping.Name()
component AnimeRelations(anime *arn.Anime, user *arn.User)
if anime.Relations() != nil && len(anime.Relations().Items) > 0
section.anime-section.mountable
h3.anime-section-name Relations
.anime-relations
each relation in anime.Relations().Items
a.anime-relation.mountable.ajax(href=relation.Anime().Link(), title=relation.Anime().Title.ByUser(user), data-mountable-type="relation")
2017-11-09 18:31:25 +00:00
img.anime-relation-image.lazy(data-src=relation.Anime().Image("small"), data-webp="true", alt=relation.Anime().Title.ByUser(user))
2017-11-04 10:09:19 +00:00
.anime-relation-type= relation.HumanReadableType()
.anime-relation-year
if relation.Anime().StartDate != ""
span= relation.Anime().StartDate[:4]
2017-11-04 07:45:39 +00:00
component AnimeTrailer(anime *arn.Anime)
if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].ServiceID != ""
2017-11-04 10:09:19 +00:00
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")
2017-11-04 07:45:39 +00:00
component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem)
if len(friends) > 0
section.anime-section.mountable
h3.anime-section-name Friends
2017-11-09 17:10:10 +00:00
2017-11-04 07:45:39 +00:00
.anime-friends
.user-avatars
each friend in friends
if friend.Nick != ""
2017-11-04 10:09:19 +00:00
.mountable(data-mountable-type="friend")
if friend.IsActive()
2017-11-04 07:45:39 +00:00
FriendEntry(friend, listItems)
2017-11-04 10:09:19 +00:00
else
.inactive-user
FriendEntry(friend, listItems)
2017-11-04 07:45:39 +00:00
component AnimeInformation(anime *arn.Anime)
section.anime-section.mountable
h3.anime-section-name Information
table.anime-info-table
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Type:
td.anime-info-value= anime.TypeHumanReadable()
2017-11-04 07:45:39 +00:00
if anime.EpisodeCount != 0
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Episodes:
td.anime-info-value= anime.EpisodeCount
2017-11-04 07:45:39 +00:00
if anime.EpisodeLength != 0
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Episode length:
td.anime-info-value= strconv.Itoa(anime.EpisodeLength) + " min."
2017-11-04 07:45:39 +00:00
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Status:
td.anime-info-value= anime.StatusHumanReadable()
2017-11-09 17:10:10 +00:00
2017-11-04 07:45:39 +00:00
if anime.StartDate == anime.EndDate && anime.StartDate != "" && anime.EndDate != ""
if anime.StartDate != ""
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Airing date:
td.anime-info-value= anime.StartDate
2017-11-04 07:45:39 +00:00
else
if anime.StartDate != ""
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Start date:
td.anime-info-value= anime.StartDate
2017-11-04 07:45:39 +00:00
if anime.EndDate != ""
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key End date:
td.anime-info-value= anime.EndDate
2016-11-02 13:47:22 +00:00
2017-11-04 07:45:39 +00:00
if anime.FirstChannel != ""
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
td.anime-info-key Channel:
td.anime-info-value= anime.FirstChannel
2017-07-21 09:49:28 +00:00
component FriendEntry(friend *arn.User, listItems map[*arn.User]*arn.AnimeListItem)
CustomAvatar(friend, listItems[friend].Link(friend.Nick), friend.Nick + " => " + listItems[friend].Status + " | " + toString(listItems[friend].Episodes) + " eps | " + fmt.Sprintf("%.1f", listItems[friend].Rating.Overall) + " rating")