From a64cac5e5e811bf8c970647e96d7a050ec2ff689 Mon Sep 17 00:00:00 2001 From: Kfir Hadas Date: Thu, 25 May 2017 12:40:46 +0300 Subject: [PATCH] Basic collapsible file tree --- nyaa/static/css/main.css | 35 ++++++++++++++++++++++++++++++++ nyaa/static/js/main.js | 8 ++++++++ nyaa/templates/layout.html | 4 ++-- nyaa/templates/view.html | 41 +++++++++++++------------------------- 4 files changed, 59 insertions(+), 29 deletions(-) diff --git a/nyaa/static/css/main.css b/nyaa/static/css/main.css index 58226d2..c98de7d 100755 --- a/nyaa/static/css/main.css +++ b/nyaa/static/css/main.css @@ -286,3 +286,38 @@ a.text-purple:hover, a.text-purple:active, a.text-purple:focus { color: #a760e0; margin: 0 auto; text-align: center; } + +/* Torrent file list */ +.torrent-file-list { + padding: 15px; +} + +.torrent-file-list ul { + padding: 5px 20px; + list-style: none; +} + +.torrent-file-list > ul:first-child { + padding: 0; +} + +.torrent-file-list li { + margin-bottom: 5px; +} + +.torrent-file-list i.fa { + padding-right: 5px; +} + +.torrent-file-list i.fa-folder-open { + padding-right: 3px; +} + +.torrent-file-list a.folder { + font-weight: bold; + text-decoration: none; +} + +.torrent-file-list .file-size { + font-weight: bold; +} diff --git a/nyaa/static/js/main.js b/nyaa/static/js/main.js index 01e7067..f57110c 100644 --- a/nyaa/static/js/main.js +++ b/nyaa/static/js/main.js @@ -43,6 +43,7 @@ $(document).ready(function() { } }); + // Drag & Drop zone for upload page $('body').on('dragenter', function(event) { event.preventDefault(); dropZone.css({ 'visibility': 'visible', 'opacity': 1 }); @@ -63,6 +64,13 @@ $(document).ready(function() { $('#torrent_file')[0].files = files; $(this).css({ 'visibility': 'hidden', 'opacity': 0 }); }); + + // Collapsible file lists + $('.torrent-file-list a.folder').click(function(e) { + e.preventDefault(); + $(this).blur().children('i').toggleClass('fa-folder-open fa-folder'); + $(this).next().stop().slideToggle(250); + }); }); function _format_time_difference(seconds) { diff --git a/nyaa/templates/layout.html b/nyaa/templates/layout.html index 6abf32b..659bb46 100755 --- a/nyaa/templates/layout.html +++ b/nyaa/templates/layout.html @@ -28,7 +28,7 @@ - + @@ -36,7 +36,7 @@ - +