Start adding search for mobile

This commit is contained in:
Mark Henle 2016-11-08 21:51:40 -05:00
parent 3dc03b1096
commit 4e76462794

View file

@ -37,14 +37,23 @@ object Search extends LilaController {
RateLimitGlobal("-", cost = cost) {
Env.game.cached.nbTotal flatMap { nbGames =>
implicit def req = ctx.body
searchForm.bindFromRequest.fold(
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
data => data.nonEmptyQuery ?? { query =>
env.paginator(query, page) map (_.some)
} map { pager =>
Ok(html.search.index(searchForm fill data, pager, nbGames))
}
)
negotiate (
html = searchForm.bindFromRequest.fold(
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
data => data.nonEmptyQuery ?? { query =>
env.paginator(query, page) map (_.some)
} map { pager =>
Ok(html.search.index(searchForm fill data, pager, nbGames))
}
),
api = _ => searchForm.bindFromRequest.fold(
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
data => data.nonEmptyQuery ?? { query =>
env.paginator(query, page) map (_.some)
} map { pager =>
Ok(_)
}
)
}
}
}