Allow to reverse taxonomy entries.

This commit is contained in:
David Calavera 2015-05-09 15:21:30 -07:00 committed by bep
parent be3a3506c4
commit d5c77bdf68

View file

@ -116,6 +116,14 @@ func (ie OrderedTaxonomyEntry) Term() string {
return ie.Name
}
func (t OrderedTaxonomy) Reverse() OrderedTaxonomy {
for i, j := 0, len(t)-1; i < j; i, j = i+1, j-1 {
t[i], t[j] = t[j], t[i]
}
return t
}
/*
* Implementation of a custom sorter for OrderedTaxonomies
*/