Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix table sorting

Cette révision appartient à :
Eliot Whalan 2017-05-14 22:30:09 +10:00
Parent 4c25077875
révision ec80ada958

Voir le fichier

@ -41,22 +41,23 @@ var FuncMap = template.FuncMap{
order := false
if _, ok := values["order"]; ok {
order, _ = strconv.ParseBool(values["order"][0])
if values["sort"][0]==sortBy {
order=!order //Flip order by repeat-clicking
if values["sort"][0] == sortBy {
order = !order //Flip order by repeat-clicking
} else {
order=false //Default to descending when sorting by something new
order = false //Default to descending when sorting by something new
}
}
currentUrl.Path = "/search"
values.Set("sort", sortBy)
values.Set("order", strconv.FormatBool(order))
currentUrl.RawQuery=values.Encode()
currentUrl.RawQuery = values.Encode()
return template.URL(currentUrl.String())
},
"genNav": func(nav Navigation, currentUrl *url.URL, pagesSelectable int) template.HTML {
var ret = ""
if (nav.TotalItem > 0) {
if nav.TotalItem > 0 {
maxPages := math.Ceil(float64(nav.TotalItem) / float64(nav.MaxItemPerPage))
if nav.CurrentPage-1 > 0 {
@ -104,9 +105,9 @@ var FuncMap = template.FuncMap{
return template.HTML(str)
},
"calcWidthSeed": func(seed uint32, leech uint32) float64 {
return float64(float64(seed)/(float64(seed)+float64(leech)))*100
return float64(float64(seed)/(float64(seed)+float64(leech))) * 100
},
"calcWidthLeech": func(seed uint32, leech uint32) float64 {
return float64(float64(leech)/(float64(seed)+float64(leech)))*100
return float64(float64(leech)/(float64(seed)+float64(leech))) * 100
},
}