From 3bd0f8c97afcfe0048baab573042b20d9329fdb6 Mon Sep 17 00:00:00 2001 From: Scott Date: Sun, 26 Nov 2017 00:14:20 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20Added=20the=20ability=20to=20se?= =?UTF-8?q?arch=20for=20a=20character?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pages/search/search.go | 5 +++-- pages/search/search.pixy | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pages/search/search.go b/pages/search/search.go index 1d7d74bd..bc1bed24 100644 --- a/pages/search/search.go +++ b/pages/search/search.go @@ -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)) } diff --git a/pages/search/search.pixy b/pages/search/search.pixy index c63ab6f9..5abb95f7 100644 --- a/pages/search/search.pixy +++ b/pages/search/search.pixy @@ -1,4 +1,4 @@ -component SearchResults(term string, users []*arn.User, animes []*arn.Anime, posts []*arn.Post, threads []*arn.Thread, tracks []*arn.SoundTrack) +component SearchResults(term string, users []*arn.User, animes []*arn.Anime, posts []*arn.Post, threads []*arn.Thread, tracks []*arn.SoundTrack, characters []*arn.Character) h1.page-title= "Search: " + term .search @@ -64,4 +64,17 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos each user in users .mountable(data-mountable-type="user") Avatar(user) - //- a.ajax(href=user.Link())= user.Nick \ No newline at end of file + //- a.ajax(href=user.Link())= user.Nick + .widget + h3.widget-title + Icon("user") + span Characters + + .user-avatars.user-search + if len(characters) == 0 + p.no-search-results.mountable No characters found. + else + each character in characters + .mountable(data-mountable-type="character") + Character(character) + //- a.ajax(href=user.Link())= user.Nick \ No newline at end of file From e3e54acbc9f755adde86941b802e9fe26ea7fbdd Mon Sep 17 00:00:00 2001 From: Scott Date: Sun, 26 Nov 2017 01:51:25 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=91=8C=20Applied=20the=20review=20fix?= =?UTF-8?q?es=20suggested=20by=20eduard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/search/search.pixy | 2 +- pages/search/search.scarlet | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/search/search.pixy b/pages/search/search.pixy index 5abb95f7..ecab2f99 100644 --- a/pages/search/search.pixy +++ b/pages/search/search.pixy @@ -70,7 +70,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos Icon("user") span Characters - .user-avatars.user-search + .character-search if len(characters) == 0 p.no-search-results.mountable No characters found. else diff --git a/pages/search/search.scarlet b/pages/search/search.scarlet index e28c14da..3acfbe56 100644 --- a/pages/search/search.scarlet +++ b/pages/search/search.scarlet @@ -3,6 +3,9 @@ .soundtrack-search justify-content flex-start +.character-search + horizontal-wrap + .anime-search-result width 55px !important height 78px !important