From dc93222579b014ad406df7211f25a0ab5af7e875 Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Tue, 26 Mar 2019 17:54:12 +0100 Subject: [PATCH] Update 2 column author list view --- cps/static/js/filter_list.js | 20 ++++++++++++++++++-- cps/templates/list.html | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) 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 @@
{% for entry in entries %} + {% if loop.index0 == (loop.length/2+loop.length%2)|int and loop.length > 20 %} +
+
+ {% endif %}
{{entry.count}}