Added anime list to characters

This commit is contained in:
Eduard Urbach 2017-11-19 15:15:44 +01:00
parent d833cfd3bb
commit d02cf3fd1c
4 changed files with 33 additions and 12 deletions

View File

@ -6,10 +6,12 @@ import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get character.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
character, err := arn.GetCharacter(id)
@ -17,5 +19,5 @@ func Get(ctx *aero.Context) string {
return ctx.Error(http.StatusNotFound, "Character not found", err)
}
return ctx.HTML(components.CharacterDetails(character))
return ctx.HTML(components.CharacterDetails(character, user))
}

View File

@ -1,13 +1,20 @@
component CharacterDetails(character *arn.Character)
component CharacterDetails(character *arn.Character, user *arn.User)
.character-page
.character-header
.character-image-container
img.character-image-fullsize(src=character.Image, alt=character.Name)
.character-description-container
h1.character-name= character.Name
.anime-alternative-title
Japanese("日本語の名前無し")
.character-description!= markdown.Render(character.Description)
.character-left-column
.character-header
.character-image-container
img.character-image-fullsize(src=character.Image, alt=character.Name)
.character-description-container
h1.character-name= character.Name
.anime-alternative-title
Japanese("日本語の名前無し")
.character-description!= markdown.Render(character.Description)
h3 Anime
.character-anime
each anime in character.Anime()
a.character-anime-item.ajax(href=anime.Link(), title=anime.Title.ByUser(user))
img.character-anime-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.ByUser(user))
if len(character.Attributes) > 0
.character-sidebar

View File

@ -1,6 +1,9 @@
.character-page
vertical
.character-left-column
vertical
.character-header
vertical
@ -31,6 +34,15 @@
.character-attributes-value
text-align right
.character-anime
horizontal-wrap
.character-anime-item
anime-mini-item
.character-anime-item-image
anime-mini-item-image
> 1250px
.character-page
horizontal

View File

@ -19,8 +19,8 @@ component Track(track *arn.SoundTrack, user *arn.User)
.sound-track-anime-list
each anime in track.Anime()
a.sound-track-anime-list-item.ajax(href=anime.Link(), title=anime.Title.Canonical)
img.sound-track-anime-list-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.Canonical)
a.sound-track-anime-list-item.ajax(href=anime.Link(), title=anime.Title.ByUser(user))
img.sound-track-anime-list-item-image.lazy(data-src=anime.Image("small"), data-webp="true", alt=anime.Title.ByUser(user))
if len(track.Beatmaps()) > 0
.widget.mountable