Added soundtrack search

This commit is contained in:
Eduard Urbach 2017-11-07 14:53:02 +01:00
parent 3ad350697a
commit eb3ecc18d6
3 changed files with 18 additions and 10 deletions

View File

@ -10,11 +10,12 @@ const maxUsers = 25
const maxAnime = 25 const maxAnime = 25
const maxPosts = 3 const maxPosts = 3
const maxThreads = 3 const maxThreads = 3
const maxTracks = 5
// Get search page. // Get search page.
func Get(ctx *aero.Context) string { func Get(ctx *aero.Context) string {
term := ctx.Query("q") term := ctx.Query("q")
userResults, animeResults, postResults, threadResults := arn.Search(term, maxUsers, maxAnime, maxPosts, maxThreads) users, animes, posts, threads, tracks := arn.Search(term, maxUsers, maxAnime, maxPosts, maxThreads, maxTracks)
return ctx.HTML(components.SearchResults(term, userResults, animeResults, postResults, threadResults)) return ctx.HTML(components.SearchResults(term, users, animes, posts, threads, tracks))
} }

View File

@ -1,4 +1,4 @@
component SearchResults(term string, users []*arn.User, animeResults []*arn.Anime, postResults []*arn.Post, threadResults []*arn.Thread) component SearchResults(term string, users []*arn.User, animes []*arn.Anime, posts []*arn.Post, threads []*arn.Thread, tracks []*arn.SoundTrack)
h1.page-title= "Search: " + term h1.page-title= "Search: " + term
.search .search
@ -8,10 +8,10 @@ component SearchResults(term string, users []*arn.User, animeResults []*arn.Anim
span Anime span Anime
.profile-watching-list.anime-search .profile-watching-list.anime-search
if len(animeResults) == 0 if len(animes) == 0
p.no-search-results.mountable No anime found. p.no-search-results.mountable No anime found.
else else
each anime in animeResults each anime in animes
a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime") a.profile-watching-list-item.mountable.ajax(href=anime.Link(), title=anime.Title.Canonical, data-mountable-type="anime")
img.anime-cover-image.anime-search-result(src=anime.Image.Tiny, alt=anime.Title.Canonical) img.anime-cover-image.anime-search-result(src=anime.Image.Tiny, alt=anime.Title.Canonical)
@ -20,10 +20,10 @@ component SearchResults(term string, users []*arn.User, animeResults []*arn.Anim
Icon("comment") Icon("comment")
span Forum span Forum
if len(postResults) == 0 && len(threadResults) == 0 if len(posts) == 0 && len(threads) == 0
p.no-search-results.mountable No posts found. p.no-search-results.mountable No posts found.
else else
each thread in threadResults each thread in threads
.mountable(data-mountable-type="forum") .mountable(data-mountable-type="forum")
.forum-search-result .forum-search-result
a.forum-search-result-title.ajax(href=thread.Link())= thread.Title a.forum-search-result-title.ajax(href=thread.Link())= thread.Title
@ -31,7 +31,7 @@ component SearchResults(term string, users []*arn.User, animeResults []*arn.Anim
.forum-search-result-author= thread.Author().Nick .forum-search-result-author= thread.Author().Nick
.forum-search-result-sample= thread.Text .forum-search-result-sample= thread.Text
each post in postResults each post in posts
.mountable(data-mountable-type="forum") .mountable(data-mountable-type="forum")
.forum-search-result .forum-search-result
a.forum-search-result-title.ajax(href=post.Link(), data-mountable-type="forum")= post.Thread().Title a.forum-search-result-title.ajax(href=post.Link(), data-mountable-type="forum")= post.Thread().Title
@ -44,7 +44,13 @@ component SearchResults(term string, users []*arn.User, animeResults []*arn.Anim
Icon("music") Icon("music")
span Soundtracks span Soundtracks
p.no-search-results.mountable Soundtrack search coming soon. if len(tracks) == 0
p.no-search-results.mountable No soundtracks found.
else
ul.soundtrack-search
each track in tracks
li
a.ajax(href=track.Link())= track.Title
.widget .widget
h3.widget-title h3.widget-title

View File

@ -1,5 +1,6 @@
.anime-search, .anime-search,
.user-search .user-search,
.soundtrack-search
justify-content flex-start justify-content flex-start
.anime-search-result .anime-search-result