101 lines
3.7 KiB
Plaintext
Raw Normal View History

2018-04-10 19:25:45 +00:00
component CharacterTabs(character *arn.Character, user *arn.User)
.tabs
Tab("Character", "user", character.Link())
Tab("Edit", "pencil", character.Link() + "/edit")
Tab("Images", "image", character.Link() + "/edit/images")
2018-04-10 19:25:45 +00:00
Tab("History", "history", character.Link() + "/history")
component CharacterDetails(character *arn.Character, characterAnime []*arn.Anime, quotes []*arn.Quote, friends []*arn.User, relevantCharacters []*arn.Character, mainQuote *arn.Quote, user *arn.User)
2017-11-12 12:41:19 +00:00
.character-page
2017-11-19 14:15:44 +00:00
.character-left-column
.character-header
2018-04-04 19:23:59 +00:00
.character-image-container.mountable
2018-04-11 13:06:08 +00:00
img.character-image-large.lazy(data-src=character.ImageLink("large"), data-webp="true", data-color=character.AverageColor(), alt=character.Name.Canonical)
2018-04-19 14:23:14 +00:00
.buttons
LikeButton(strconv.Itoa(len(character.Likes)), "heart", "character", character, user)
if user != nil && (user.Role == "editor" || user.Role == "admin")
a.button.tip.mountable(href=character.Link() + "/edit", aria-label="Edit character")
RawIcon("pencil")
2018-04-04 19:23:59 +00:00
2017-11-19 14:15:44 +00:00
.character-description-container
2018-04-04 19:23:59 +00:00
h1.character-name.mountable= character.Name.Canonical
2018-03-27 03:25:25 +00:00
2018-04-04 19:23:59 +00:00
.anime-alternative-title.mountable
2018-03-27 03:25:25 +00:00
if character.Name.Japanese != ""
Japanese(character.Name.Japanese)
2018-04-10 18:56:56 +00:00
if mainQuote != nil
2018-04-10 18:15:57 +00:00
.character-quote
Quote(mainQuote, user)
2018-04-10 18:56:56 +00:00
2018-04-04 19:23:59 +00:00
.character-description.mountable!= markdown.Render(character.Description)
2017-11-19 14:15:44 +00:00
2018-04-04 19:23:59 +00:00
h3.mountable Anime
.character-anime.mountable
2017-11-20 08:01:28 +00:00
each anime in characterAnime
2018-04-18 11:09:13 +00:00
a.character-anime-item.tip.mountable(href=anime.Link(), aria-label=anime.Title.ByUser(user), data-mountable-type="anime")
2018-03-20 21:39:21 +00:00
img.character-anime-item-image.lazy(data-src=anime.ImageLink("small"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
2018-02-25 16:06:47 +00:00
2018-04-12 12:39:03 +00:00
if len(quotes) > 0 && (len(quotes) > 1 || mainQuote != quotes[0])
2018-04-04 19:23:59 +00:00
h3.mountable Quotes
.character-quotes.mountable
each quote in quotes
2018-04-10 18:56:56 +00:00
if mainQuote == nil || quote.ID != mainQuote.ID
.character-quote
Quote(quote, user)
2017-11-12 12:41:19 +00:00
2018-04-04 19:23:59 +00:00
.character-sidebar
if len(character.Attributes) > 0
h3.mountable Information
table.character-attributes.mountable
2017-11-12 12:41:19 +00:00
each attribute in character.Attributes
tr.mountable(data-mountable-type="info")
td.character-attributes-name= attribute.Name + ":"
2017-11-12 12:48:21 +00:00
if strings.Contains(attribute.Value, "<")
td.character-attributes-value!= markdown.Render(attribute.Value)
else
td.character-attributes-value= attribute.Value
2018-04-04 19:23:59 +00:00
if len(relevantCharacters) > 0
h3.mountable Relevant
.relevant-characters.mountable
each relevantCharacter in relevantCharacters
.mountable(data-mountable-type="relevant-character")
CharacterSmall(relevantCharacter, user)
2018-04-19 15:48:15 +00:00
if len(friends) > 0
.character-friends
h3.mountable Friends
.user-avatars.mountable
each friend in friends
.mountable(data-mountable-type="friend")
if friend.IsActive()
Avatar(friend)
else
.inactive-user
Avatar(friend)
h3.mountable Links
2018-04-04 19:23:59 +00:00
.light-button-group.mountable
if character.GetMapping("myanimelist/character") != ""
2018-04-04 19:23:59 +00:00
a.light-button(href="https://myanimelist.net/character/" + character.GetMapping("myanimelist/character"), target="_blank", rel="noopener")
Icon("external-link")
span MAL
2018-04-23 12:21:55 +00:00
else if user != nil && (user.Role == "editor" || user.Role == "admin")
a.light-button(href="https://myanimelist.net/character.php?q=" + character.Name.Canonical, target="_blank", rel="noopener")
Icon("exclamation-triangle")
span Error: No MAL ID
a.light-button(href="/api" + character.Link(), target="_blank")
Icon("code")
span API