1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-11-28 20:39:59 +00:00

Update 2 column author list view

This commit is contained in:
Ozzieisaacs 2019-03-26 17:54:12 +01:00
parent 772f978b45
commit dc93222579
2 changed files with 22 additions and 2 deletions

View File

@ -22,8 +22,17 @@ $("#desc").click(function() {
return; return;
} }
var list = $('#list'); var list = $('#list');
var second = $('#second');
var listItems = list.children(".row"); 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; direction = 0;
}); });
@ -33,8 +42,15 @@ $("#asc").click(function() {
return; return;
} }
var list = $("#list"); var list = $("#list");
var second = $('#second');
var listItems = list.children(".row"); 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; direction = 1;
}); });

View File

@ -17,6 +17,10 @@
<div class="container"> <div class="container">
<div id="list" class="col-xs-12 col-sm-6"> <div id="list" class="col-xs-12 col-sm-6">
{% for entry in entries %} {% for entry in entries %}
{% if loop.index0 == (loop.length/2+loop.length%2)|int and loop.length > 20 %}
</div>
<div id="second" class="col-xs-12 col-sm-6">
{% endif %}
<div class="row" data-id="{% if entry[0].sort %}{{entry[0].sort}}{% else %}{% if entry.name %}{{entry.name}}{% else %}{{entry[0].name}}{% endif %}{% endif %}"> <div class="row" data-id="{% if entry[0].sort %}{{entry[0].sort}}{% else %}{% if entry.name %}{{entry.name}}{% else %}{{entry[0].name}}{% endif %}{% endif %}">
<div class="col-xs-2 col-sm-2 col-md-1" align="left"><span class="badge">{{entry.count}}</span></div> <div class="col-xs-2 col-sm-2 col-md-1" align="left"><span class="badge">{{entry.count}}</span></div>
<div class="col-xs-10 col-sm-10 col-md-11"><a id="list_{{loop.index0}}" href="{% if entry.format %}{{url_for(folder, data=data, sort='new', book_id=entry.format )}}{% else %}{{url_for(folder, data=data, sort='new', book_id=entry[0].id )}}{% endif %}"> <div class="col-xs-10 col-sm-10 col-md-11"><a id="list_{{loop.index0}}" href="{% if entry.format %}{{url_for(folder, data=data, sort='new', book_id=entry.format )}}{% else %}{{url_for(folder, data=data, sort='new', book_id=entry[0].id )}}{% endif %}">