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/aerogo/aero"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
) )
// Get character. // Get character.
func Get(ctx *aero.Context) string { func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id") id := ctx.Get("id")
character, err := arn.GetCharacter(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.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-page
.character-header .character-left-column
.character-image-container .character-header
img.character-image-fullsize(src=character.Image, alt=character.Name) .character-image-container
.character-description-container img.character-image-fullsize(src=character.Image, alt=character.Name)
h1.character-name= character.Name .character-description-container
.anime-alternative-title h1.character-name= character.Name
Japanese("日本語の名前無し") .anime-alternative-title
.character-description!= markdown.Render(character.Description) 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 if len(character.Attributes) > 0
.character-sidebar .character-sidebar

View File

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

View File

@ -19,8 +19,8 @@ component Track(track *arn.SoundTrack, user *arn.User)
.sound-track-anime-list .sound-track-anime-list
each anime in track.Anime() each anime in track.Anime()
a.sound-track-anime-list-item.ajax(href=anime.Link(), title=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.Canonical) 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 if len(track.Beatmaps()) > 0
.widget.mountable .widget.mountable