Fix table sorting
Cette révision appartient à :
Parent
4c25077875
révision
ec80ada958
1 fichiers modifiés avec 36 ajouts et 35 suppressions
|
@ -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
|
||||
},
|
||||
}
|
||||
|
|
Référencer dans un nouveau ticket