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 à :
Parent
3b9574f648
révision
a6a7f26a42
1 fichiers modifiés avec 8 ajouts et 6 suppressions
|
@ -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)
|
||||
}
|
||||
|
|
Référencer dans un nouveau ticket