Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Keep search content and keep refine open in no_results page (#1319)

* Update search.go

* Improvement

You don't actually need to set a variable type. Golang infers it from the right side of the equal :).
I needed in templates to do that since I need to use it in conditions. But since you removed the condition, it's not necessary
Cette révision appartient à :
kilo 2017-08-02 19:34:17 +02:00 révisé par akuma06
Parent 3b9574f648
révision a6a7f26a42

Voir le fichier

@ -48,12 +48,6 @@ func SearchHandler(c *gin.Context) {
return
}
maxPages := math.Ceil(float64(nbTorrents) / float64(searchParam.Max))
if pagenum > int(maxPages) {
templates.Static(c, "errors/no_results.jet.html")
return
}
// Convert back to strings for now.
category := ""
if len(searchParam.Category) > 0 {
@ -67,5 +61,13 @@ func SearchHandler(c *gin.Context) {
searchForm.ShowRefine = true
}
maxPages := math.Ceil(float64(nbTorrents) / float64(searchParam.Max))
if pagenum > int(maxPages) {
variables := templates.Commonvariables(c)
variables.Set("Search", searchForm)
templates.Render(c, "errors/no_results.jet.html", variables)
return
}
templates.ModelList(c, "site/torrents/listing.jet.html", models.TorrentsToJSON(torrents), nav, searchForm)
}