267 lines
10 KiB
Plaintext
Raw Normal View History

component Anime(anime *arn.Anime, listItem *arn.AnimeListItem, tracks []*arn.SoundTrack, amvs []*arn.AMV, amvAppearances []*arn.AMV, 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
AnimeMainColumn(anime, listItem, tracks, amvs, amvAppearances, episodes, user)
2017-11-04 07:45:39 +00:00
.anime-side-column
AnimeSideColumn(anime, friends, listItems, user)
component AnimeMainColumn(anime *arn.Anime, listItem *arn.AnimeListItem, tracks []*arn.SoundTrack, amvs []*arn.AMV, amvAppearances []*arn.AMV, episodes []*arn.AnimeEpisode, user *arn.User)
2017-11-04 07:45:39 +00:00
.anime-header(data-id=anime.ID)
2018-06-30 03:13:04 +00:00
a.anime-image-container.mountable(href=anime.ImageLink("original"), target="_blank", data-mountable-type="header")
2018-03-20 21:39:21 +00:00
img.anime-cover-image.lazy(data-src=anime.ImageLink("large"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
2017-11-09 17:10:10 +00:00
2017-11-04 07:45:39 +00:00
.space
.anime-info
2018-06-30 03:13:04 +00:00
h1.anime-title.mountable(title=anime.Type, data-mountable-type="header")= anime.Title.ByUser(user)
2017-11-04 07:45:39 +00:00
2018-06-30 03:13:04 +00:00
h2.anime-alternative-title.mountable(data-mountable-type="header")
2017-11-04 07:45:39 +00:00
Japanese(anime.Title.Japanese)
2018-06-30 03:13:04 +00:00
p.anime-summary.mountable(data-mountable-type="header")= anime.Summary
2017-11-09 17:10:10 +00:00
2017-11-29 23:54:09 +00:00
.anime-summary-footer-container
.anime-summary-footer
AnimeGenres(anime)
AnimeActions(anime, listItem, user)
2017-11-09 17:10:10 +00:00
AnimeCharacters(anime, user, false)
AnimeRelations(anime, user, false)
AnimeTracks(anime, tracks, user, false)
AnimeAMVs(anime, amvs, amvAppearances, user)
2018-04-15 08:36:51 +00:00
AnimeEpisodes(anime, episodes, user, false)
2018-11-01 05:45:16 +00:00
AnimeComments(anime, user, false)
2018-04-14 00:45:29 +00:00
2017-11-05 08:55:42 +00:00
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)
2018-04-03 21:58:30 +00:00
AnimeLinks(anime, user)
2017-11-05 08:55:42 +00:00
component AnimeActions(anime *arn.Anime, listItem *arn.AnimeListItem, user *arn.User)
2017-11-04 07:45:39 +00:00
if user != nil
2017-11-29 23:54:09 +00:00
.buttons.anime-actions
2017-11-05 10:02:31 +00:00
if user.Role == "editor" || user.Role == "admin"
2018-06-30 03:13:04 +00:00
a.button.mountable(href=anime.Link() + "/edit", data-mountable-type="header")
2017-11-05 10:02:31 +00:00
Icon("pencil-square-o")
span Edit anime
2017-11-04 07:45:39 +00:00
if listItem != nil
2018-06-30 03:13:04 +00:00
a.button.mountable(href="/+" + user.Nick + "/animelist/anime/" + anime.ID, data-mountable-type="header")
2017-11-04 07:45:39 +00:00
Icon("pencil")
span= listItem.StatusHumanReadable()
2017-11-04 07:45:39 +00:00
else
2018-06-30 03:13:04 +00:00
button.mountable.action(data-api="/api/animelist/" + user.ID, data-action="addAnimeToCollection", data-trigger="click", data-anime-id=anime.ID, data-mountable-type="header")
2017-11-04 07:45:39 +00:00
Icon("plus")
span Add to collection
2017-11-04 10:09:19 +00:00
component AnimeRatings(anime *arn.Anime, user *arn.User)
2018-06-30 03:13:04 +00:00
section.anime-section.mountable(data-mountable-type="sidebar")
2017-11-04 10:09:19 +00:00
h3.anime-section-name Ratings
table.anime-info-table
2018-04-18 14:27:08 +00:00
tbody
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="ratings")
2018-04-18 14:27:08 +00:00
td.anime-info-key
if anime.Status == "upcoming"
span Hype:
else
span Overall:
2017-11-04 10:09:19 +00:00
td.anime-info-value
2018-04-18 14:27:08 +00:00
Rating(anime.Rating.Overall, anime.Rating.Count.Overall, user)
2017-11-04 10:09:19 +00:00
2018-04-18 14:27:08 +00:00
if anime.Rating.Count.Story > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="ratings")
2018-04-18 14:27:08 +00:00
td.anime-info-key Story:
td.anime-info-value
Rating(anime.Rating.Story, anime.Rating.Count.Story, user)
2017-11-04 10:09:19 +00:00
2018-04-18 14:27:08 +00:00
if anime.Rating.Count.Visuals > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="ratings")
2018-04-18 14:27:08 +00:00
td.anime-info-key Visuals:
td.anime-info-value
Rating(anime.Rating.Visuals, anime.Rating.Count.Visuals, user)
if anime.Rating.Count.Soundtrack > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="ratings")
2018-04-18 14:27:08 +00:00
td.anime-info-key Soundtrack:
td.anime-info-value
Rating(anime.Rating.Soundtrack, anime.Rating.Count.Soundtrack, user)
2017-11-04 10:09:19 +00:00
component AnimePopularity(anime *arn.Anime)
if anime.Popularity.Total() > 0
2018-06-30 03:13:04 +00:00
section.anime-section.mountable(data-mountable-type="sidebar")
2017-11-04 10:09:19 +00:00
h3.anime-section-name Popularity
table.anime-info-table
if anime.Popularity.Watching > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="popularity")
2017-11-04 10:09:19 +00:00
td.anime-info-key Watching:
td.anime-info-value= anime.Popularity.Watching
if anime.Popularity.Completed > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="popularity")
2017-11-04 10:09:19 +00:00
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
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="popularity")
2017-11-04 10:09:19 +00:00
td.anime-info-key Planned:
td.anime-info-value= anime.Popularity.Planned
if anime.Popularity.Hold > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="popularity")
2017-11-04 10:09:19 +00:00
td.anime-info-key On hold:
td.anime-info-value= anime.Popularity.Hold
if anime.Popularity.Dropped > 0
2018-06-30 03:13:04 +00:00
tr.mountable(data-mountable-type="popularity")
2017-11-04 10:09:19 +00:00
td.anime-info-key Dropped:
td.anime-info-value= anime.Popularity.Dropped
2018-04-03 21:58:30 +00:00
component AnimeLinks(anime *arn.Anime, user *arn.User)
2018-06-30 03:13:04 +00:00
section.anime-section.mountable(data-mountable-type="sidebar")
2017-11-04 10:09:19 +00:00
h3.anime-section-name Links
2018-04-04 19:23:59 +00:00
2017-11-04 10:09:19 +00:00
.light-button-group
2018-03-01 11:26:07 +00:00
each link in anime.Links
a.light-button(href=link.URL, target="_blank", rel="noopener")
Icon("external-link")
span= link.Title
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()
2018-04-03 21:58:30 +00:00
a.light-button(href="https://www.google.com/search?btnI=745&q=" + anime.Title.ByUser(user) + "+TV+series+site%3Aen.wikipedia.org", target="_blank", rel="noopener")
Icon("wikipedia-w")
span Wikipedia
2018-04-12 07:54:47 +00:00
a.light-button(href="/api/anime/" + anime.ID, target="_blank", rel="noopener")
Icon("code")
span API
2017-11-04 10:09:19 +00:00
2017-11-29 23:48:02 +00:00
component AnimeGenres(anime *arn.Anime)
.anime-genres
each genre in anime.Genres
2018-06-30 03:13:04 +00:00
a.anime-genre.mountable(href="/genre/" + strings.ToLower(genre), data-mountable-type="header")
2017-11-29 23:48:02 +00:00
span= genre
2017-11-04 07:45:39 +00:00
component AnimeTrailer(anime *arn.Anime)
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[index].ServiceID + "?showinfo=0", importance="low", allowfullscreen)
2017-11-04 07:45:39 +00:00
component AnimeFriends(friends []*arn.User, listItems map[*arn.User]*arn.AnimeListItem)
if len(friends) > 0
2018-06-30 03:13:04 +00:00
section.anime-section.mountable(data-mountable-type="sidebar")
2017-11-04 07:45:39 +00:00
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)
2018-06-30 03:13:04 +00:00
section.anime-section.mountable(data-mountable-type="sidebar")
2017-11-04 07:45:39 +00:00
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
2018-04-13 16:11:15 +00:00
if anime.StartDate == anime.EndDate && validate.Date(anime.StartDate) && validate.Date(anime.EndDate)
tr.mountable(data-mountable-type="info")
td.anime-info-key Airing date:
td.anime-info-value= anime.StartDateTime().Format("Jan _2, 2006")
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")
2018-04-13 16:07:21 +00:00
td.anime-info-key Start:
2017-11-04 07:45:39 +00:00
if validate.Date(anime.StartDate)
td.anime-info-value= anime.StartDateTime().Format("Jan _2, 2006")
else if len(anime.StartDate) >= len("2006-01")
td.anime-info-value= anime.StartDateTime().Format("Jan, 2006")
else
td.anime-info-value= anime.StartDate
if anime.EndDate != ""
2017-11-04 10:09:19 +00:00
tr.mountable(data-mountable-type="info")
2018-04-13 16:07:21 +00:00
td.anime-info-key End:
if validate.Date(anime.EndDate)
td.anime-info-value= anime.EndDateTime().Format("Jan _2, 2006")
else if len(anime.EndDate) >= len("2006-01")
td.anime-info-value= anime.EndDateTime().Format("Jan, 2006")
else
td.anime-info-value= anime.EndDate
2018-03-10 22:24:23 +00:00
2018-04-13 16:11:15 +00:00
if anime.Season() != ""
tr.mountable(data-mountable-type="info")
td.anime-info-key Season:
2018-04-17 00:43:44 +00:00
td.anime-info-value
a(href="/explore/anime/" + anime.StartDate[:4] + "/" + strings.ToLower(anime.Season()) + "/any/" + anime.Type)= stringutils.Capitalize(anime.Season()) + " " + anime.StartDate[:4]
2018-04-13 16:11:15 +00:00
2018-03-10 22:24:23 +00:00
if anime.Source != "" && arn.AnimeSourceHumanReadable[anime.Source] != ""
tr.mountable(data-mountable-type="info")
td.anime-info-key Source:
td.anime-info-value= arn.AnimeSourceHumanReadable[anime.Source]
2016-11-02 13:47:22 +00:00
2018-04-13 16:11:15 +00:00
//- if anime.FirstChannel != ""
//- 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
2017-11-27 18:57:58 +00:00
each company in anime.Studios()
tr.mountable(data-mountable-type="info")
td.anime-info-key Studio:
td.anime-info-value
a(href=company.Link())= company.Name.English
2017-11-27 18:57:58 +00:00
2017-11-27 20:36:59 +00:00
//- section.anime-section.mountable
//- h3.anime-section-name Companies
//- table.anime-info-table
//- each company in anime.Producers()
//- tr.mountable(data-mountable-type="info")
//- td.anime-info-key Producer:
//- td.anime-info-value
//- a(href=company.Link())= company.Name.English
2017-11-27 20:36:59 +00:00
//- each company in anime.Licensors()
//- tr.mountable(data-mountable-type="info")
//- td.anime-info-key Licensor:
//- td.anime-info-value
//- a(href=company.Link())= company.Name.English
2017-11-27 20:36:59 +00:00
2017-07-21 09:49:28 +00:00
component FriendEntry(friend *arn.User, listItems map[*arn.User]*arn.AnimeListItem)
CustomAvatar(friend, friend.Link(), friend.Nick + " => " + listItems[friend].Status + " | " + fmt.Sprint(listItems[friend].Episodes) + " eps | " + fmt.Sprintf("%.1f", listItems[friend].Rating.Overall) + " rating")