fix forum search pagination
This commit is contained in:
parent
28025d3c03
commit
667b2ef833
|
@ -12,12 +12,14 @@ object ForumPost extends LilaController with forum.Controller {
|
|||
private def teamCache = env.team.cached
|
||||
private def searchPaginator = env.forum.searchPaginator
|
||||
|
||||
def search(page: Int) = OpenBody { implicit ctx ⇒
|
||||
implicit def req = ctx.body
|
||||
forms.search.bindFromRequest.fold(
|
||||
failure ⇒ Redirect(routes.ForumCateg.index),
|
||||
text ⇒ Ok(html.forum.search(text, searchPaginator(text, page, isGranted(_.StaffForum))))
|
||||
)
|
||||
def search(text: String, page: Int) = OpenBody { implicit ctx ⇒
|
||||
text.trim match {
|
||||
case "" ⇒ Redirect(routes.ForumCateg.index)
|
||||
case text ⇒ Ok(html.forum.search(
|
||||
text,
|
||||
searchPaginator(text, page, isGranted(_.StaffForum))
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
val recent = Open { implicit ctx ⇒
|
||||
|
|
|
@ -29,8 +29,6 @@ final class DataForm(captcher: Captcha) {
|
|||
"post" -> postMapping
|
||||
)(TopicData.apply)(TopicData.unapply))
|
||||
|
||||
val search = Form(single("text" -> nonEmptyText))
|
||||
|
||||
def captchaCreate: Captcha.Challenge = captcher.create
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ moreJs = jsTag("vendor/jquery.infinitescroll.min.js")
|
|||
<tbody class="infinitescroll">
|
||||
@views.nextPage.map { n =>
|
||||
<tr><th class="pager none">
|
||||
<a href="@routes.ForumPost.search(n)">Next</a>
|
||||
<a href="@routes.ForumPost.search(text, n)">Next</a>
|
||||
</th></tr>
|
||||
<tr></tr>
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ POST /bookmark/$gameId<[\w\-]{8}> controllers.Bookmark.toggle(gameId: Strin
|
|||
# Forum
|
||||
GET /forum controllers.ForumCateg.index
|
||||
GET /forum/recent controllers.ForumPost.recent
|
||||
GET /forum/search controllers.ForumPost.search(page: Int ?= 1)
|
||||
GET /forum/search controllers.ForumPost.search(text: String ?= "", page: Int ?= 1)
|
||||
GET /forum/:slug controllers.ForumCateg.show(slug: String, page: Int ?= 1)
|
||||
GET /forum/:categSlug/form controllers.ForumTopic.form(categSlug: String)
|
||||
POST /forum/:categSlug/new controllers.ForumTopic.create(categSlug: String)
|
||||
|
|
Loading…
Reference in a new issue