From 2c24c0bfbf48406b49b434587e1f0387d25648b8 Mon Sep 17 00:00:00 2001 From: buinsky Date: Fri, 22 Jan 2016 14:53:53 +0300 Subject: [PATCH] WebUI: Implement pause torrents by category --- src/webui/www/private/index.html | 1 + src/webui/www/public/filters.html | 3 +++ src/webui/www/public/scripts/mocha-init.js | 16 ++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 332572391..d0176af0d 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -130,6 +130,7 @@
  • QBT_TR(Remove category)QBT_TR QBT_TR(Remove category)QBT_TR
  • QBT_TR(Remove unused categories)QBT_TR QBT_TR(Remove unused categories)QBT_TR
  • QBT_TR(Resume torrents)QBT_TR QBT_TR(Resume torrents)QBT_TR
  • +
  • QBT_TR(Pause torrents)QBT_TR QBT_TR(Pause torrents)QBT_TR
  • diff --git a/src/webui/www/public/filters.html b/src/webui/www/public/filters.html index 08d50fff6..f7c922e8e 100644 --- a/src/webui/www/public/filters.html +++ b/src/webui/www/public/filters.html @@ -31,6 +31,9 @@ }, StartTorrentsByCategory : function (element, ref) { startTorrentsByCategoryFN(element.id); + }, + PauseTorrentsByCategory : function (element, ref) { + pauseTorrentsByCategoryFN(element.id); } }, offsets : { diff --git a/src/webui/www/public/scripts/mocha-init.js b/src/webui/www/public/scripts/mocha-init.js index 56e3fcdff..3ac1c6d67 100644 --- a/src/webui/www/public/scripts/mocha-init.js +++ b/src/webui/www/public/scripts/mocha-init.js @@ -401,6 +401,22 @@ initializeWindows = function() { } }; + pauseTorrentsByCategoryFN = function (categoryHash) { + var h = torrentsTable.getFilteredTorrentsHashes('all', categoryHash); + if (h.length) { + h.each(function (hash, index) { + new Request({ + url: 'command/pause', + method: 'post', + data: { + hash: hash + } + }).send(); + }); + updateMainData(); + } + }; + ['pauseAll', 'resumeAll'].each(function(item) { addClickEvent(item, function(e) { new Event(e).stop();