WebUI: Implement pause torrents by category

This commit is contained in:
buinsky
2016-01-22 14:53:53 +03:00
committed by sledgehammer999
parent ba5dded076
commit c60c58b092
3 changed files with 20 additions and 0 deletions

View File

@@ -31,6 +31,9 @@
},
StartTorrentsByCategory : function (element, ref) {
startTorrentsByCategoryFN(element.id);
},
PauseTorrentsByCategory : function (element, ref) {
pauseTorrentsByCategoryFN(element.id);
}
},
offsets : {

View File

@@ -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();