67 lines
2.6 KiB
Plaintext
Raw Normal View History

2017-10-21 17:23:40 +00:00
component CompareAnimeList(a *arn.User, b *arn.User, countA int, countB int, comparisons []*utils.Comparison, user *arn.User)
h1 Anime list comparison
p.comparison-info= a.Nick + "'s list contains " + strconv.Itoa(countA) + " anime and " + b.Nick + "'s list contains " + strconv.Itoa(countB) + " anime."
2017-10-21 17:16:11 +00:00
table.anime-list
thead
tr.anime-list-item.mountable
th.anime-list-item-image-container
th.anime-list-item-name
th.comparison
Avatar(a)
th.comparison
th.comparison
Avatar(b)
th.comparison
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
tbody
each comparison in comparisons
tr.anime-list-item.mountable
td.anime-list-item-image-container
a(href=comparison.Anime.Link())
2018-03-20 21:39:21 +00:00
img.anime-list-item-image.lazy(data-src=comparison.Anime.ImageLink("small"), data-webp="true", data-color=comparison.Anime.AverageColor(), alt=comparison.Anime.Title.ByUser(user))
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
td.anime-list-item-name
a(href=comparison.Anime.Link())= comparison.Anime.Title.ByUser(user)
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
td.comparison
if comparison.ItemA != nil
span= comparison.ItemA.Status
else
span -
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
td.comparison
if comparison.ItemA != nil
if comparison.ItemA.Rating.Overall != 0
if comparison.ItemB != nil && comparison.ItemB.Rating.Overall != 0 && comparison.ItemA.Rating.Overall == comparison.ItemB.Rating.Overall
span.comparison-rating-equal= utils.FormatRating(comparison.ItemA.Rating.Overall)
else
span= utils.FormatRating(comparison.ItemA.Rating.Overall)
else
span -
else
span -
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
td.comparison
if comparison.ItemB != nil
span= comparison.ItemB.Status
else
span -
2017-11-09 17:10:10 +00:00
2017-10-21 17:16:11 +00:00
td.comparison
if comparison.ItemB != nil
if comparison.ItemB.Rating.Overall != 0
if comparison.ItemA != nil && comparison.ItemA.Rating.Overall != 0
if comparison.ItemA.Rating.Overall == comparison.ItemB.Rating.Overall
span.comparison-rating-equal= utils.FormatRating(comparison.ItemB.Rating.Overall)
else if comparison.ItemB.Rating.Overall > comparison.ItemA.Rating.Overall
2018-04-18 12:34:33 +00:00
span.comparison-rating-higher.tip(aria-label=utils.FormatRating(comparison.ItemB.Rating.Overall))= "+" + utils.FormatRating(comparison.ItemB.Rating.Overall - comparison.ItemA.Rating.Overall)
2017-10-21 17:16:11 +00:00
else
2018-04-18 12:34:33 +00:00
span.comparison-rating-lower.tip(aria-label=utils.FormatRating(comparison.ItemB.Rating.Overall))= "-" + utils.FormatRating(comparison.ItemA.Rating.Overall - comparison.ItemB.Rating.Overall)
2017-10-21 17:16:11 +00:00
else
span= utils.FormatRating(comparison.ItemB.Rating.Overall)
else
span -
else
span -