diff --git a/cps/static/js/filter_list.js b/cps/static/js/filter_list.js index b4b12d58..57b195c8 100644 --- a/cps/static/js/filter_list.js +++ b/cps/static/js/filter_list.js @@ -22,8 +22,17 @@ $("#desc").click(function() { return; } var list = $('#list'); + var second = $('#second'); var listItems = list.children(".row"); - list.append(listItems.get().reverse()); + var reversed, elementLength, middle; + Array.prototype.push.apply(listItems,second.children(".row")) + reversed = listItems.get().reverse(); + elementLength = reversed.length; + + middle = parseInt(elementLength / 2) + (elementLength % 2); + + list.append(reversed.slice(0, middle)); + second.append(reversed.slice(middle,elementLength)); direction = 0; }); @@ -33,8 +42,15 @@ $("#asc").click(function() { return; } var list = $("#list"); + var second = $('#second'); var listItems = list.children(".row"); - list.append(listItems.get().reverse()); + Array.prototype.push.apply(listItems,second.children(".row")); + reversed = listItems.get().reverse(); + elementLength = reversed.length; + middle = parseInt(elementLength / 2) + (elementLength % 2); + + list.append(reversed.slice(0, middle)); + second.append(reversed.slice(middle,elementLength)); direction = 1; }); diff --git a/cps/templates/list.html b/cps/templates/list.html index 542104d0..f18d376b 100644 --- a/cps/templates/list.html +++ b/cps/templates/list.html @@ -17,6 +17,10 @@