Introduction
Introduction Statistics Contact Development Disclaimer Help
Updating torrent index layout, adding magnet link. - seedlinux - Torrent indexi…
Log
Files
Refs
README
---
commit 2c1f07d8758c02242cdf0843b296b89e24005c59
parent c3afa3ff4c0b42f15bc7c579163866fec20cebbd
Author: Jay Scott <[email protected]>
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:
A public/javascript/script.js | 3 +++
M views/details.pug | 2 +-
M views/layout.pug | 4 ++++
M views/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.j…
+ 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)
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.