seedlinux

find open source torrents and stats for people wishing to contribute bandwidth.
git clone git://git.beardyjay.co.uk/seedlinux
Log | Files | Refs | README | LICENSE

commit b53ead819f1dadf8b2cb9ad515eda74871883914
parent 20c70f3083060f98cf89654116f96d8fe9b4be46
Author: Jay Scott <jay@jayscott.co.uk>
Date:   Wed,  5 Jul 2017 18:11:29 +0100

Updating torrent index layout, adding magnet link.

So quite a bit of a change here. The card layout had quite a lot of
DOM elements loaded which was causing the client side to be quite
slow. So I have removed this for a sortable table instead, this
will also make it easier to add a search feature at a later date.

Diffstat:
Apublic/javascript/script.js | 3+++
Mviews/details.pug | 2+-
Mviews/layout.pug | 4++++
Mviews/torrent.pug | 53++++++++++++++++++++++++++++++++---------------------
4 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/public/javascript/script.js b/public/javascript/script.js @@ -0,0 +1,3 @@ +$( document ).ready(function() { + $('table').tablesort(); +}); diff --git a/views/details.pug b/views/details.pug @@ -9,7 +9,7 @@ block content table.ui.olive.table thead tr - th(colspan='2')= 'Torrent Details' + th.no-sort(colspan='2')= 'Torrent Details' tr td i.tag.olive.icon diff --git a/views/layout.pug b/views/layout.pug @@ -29,3 +29,6 @@ html .ui.container block content + script(src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js") + script(src="https://semantic-ui.com/javascript/library/tablesort.min.js") + script(src="/javascript/script.js")+ \ No newline at end of file diff --git a/views/torrent.pug b/views/torrent.pug @@ -1,24 +1,35 @@ extends layout +mixin status(torrent) + td + a(href="/torrent/details/" + torrent.hash) + = torrent.name.replace(/\.[^/.]+$/, "").toLowerCase() + td= torrent.comment + td(data-sort-value=torrent.seeders)= torrent.seeders + td(data-sort-value=torrent.leechers)= torrent.leechers + td + i.magnet.olive.icon + a(href="" + torrent.magneturi)= "Magnet" + i.barcode.olive.icon + a(href="")= "Torrent" + block content - .ui.special.four.cards - each i in data.torrent_data - a.ui.card(href="/torrent/details/" + i.hash) - .content - .header= i.name.replace(/\.[^/.]+$/, "") - .meta - span.category= "2 days ago" - .description= i.comment - .extra.content - span.left.floated - if i.seeders >= 10 - i.floated.upload.green.icon - else - i.floated.upload.red.icon - = i.seeders - span.left.floated - if i.leechers >= 50 - i.floated.download.yellow.icon - else - i.floated.download.green.icon - = i.leechers + table.ui.sortable.selectable.very.compact.olive.table + thead + tr + th= 'Name' + th.no-sort= 'Comment' + th= 'Seeders' + th= 'Leechers' + th.no-sort= 'Magnet' + tbody + each i in data.torrent_data + if i.seeders == 0 + tr.negative + +status(i) + else if i.seeders < 10 + tr.warning + +status(i) + else + tr.positive + +status(i)