Added the ability to search for a character

This addition uses the Character pixy mixin which displays the characters with a size that may be too big compared to the other type search results.
As discussed on Discord this display can be adjusted in the future.

This addition also displays a maximum of 5 characters which is obviously open to being changed since it's a number picked just for testing and not for usability.

Lastly on the search.pixy file I left the comment below the addition since removing it or rewriting the addition without it broke my build.
This commit is contained in:
Scott
2017-11-26 00:14:20 +01:00
parent 1c23d6d2a5
commit 3bd0f8c97a
2 changed files with 18 additions and 4 deletions

View File

@ -13,12 +13,13 @@ const maxAnime = 25
const maxPosts = 3
const maxThreads = 3
const maxTracks = 4
const maxCharacters = 5
// Get search page.
func Get(ctx *aero.Context) string {
term := ctx.Get("term")
term = strings.TrimPrefix(term, "/")
users, animes, posts, threads, tracks := arn.Search(term, maxUsers, maxAnime, maxPosts, maxThreads, maxTracks)
return ctx.HTML(components.SearchResults(term, users, animes, posts, threads, tracks))
users, animes, posts, threads, tracks, characters := arn.Search(term, maxUsers, maxAnime, maxPosts, maxThreads, maxTracks, maxCharacters)
return ctx.HTML(components.SearchResults(term, users, animes, posts, threads, tracks, characters))
}