summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Churchill <damoc@gmail.com>2009-01-07 19:06:28 +0000
committerDamien Churchill <damoc@gmail.com>2009-01-07 19:06:28 +0000
commit150c803d192af769d844d16cc439aa71be931fbf (patch)
treecfded75b01a3b8b205e9b25774512bef19a0958f
parentd88fe0e8945c7f0e2c887d757c7d8796e78f98c1 (diff)
downloaddeluge-150c803d192af769d844d16cc439aa71be931fbf.tar.gz
deluge-150c803d192af769d844d16cc439aa71be931fbf.tar.bz2
deluge-150c803d192af769d844d16cc439aa71be931fbf.zip
Allow torrents to be removed from the add torrent window
-rw-r--r--deluge/ui/webui/templates/ajax/static/js/deluge-add.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js
index 3d0b9527a..2c06d3fda 100644
--- a/deluge/ui/webui/templates/ajax/static/js/deluge-add.js
+++ b/deluge/ui/webui/templates/ajax/static/js/deluge-add.js
@@ -25,6 +25,7 @@ Deluge.Widgets.AddWindow = new Class({
onAdd: this.onAdd.bindWithEvent(this),
onShow: this.onShow.bindWithEvent(this),
onCancel: this.onCancel.bindWithEvent(this),
+ onRemoveClick: this.onRemoveClick.bindWithEvent(this),
onTorrentAdded: this.onTorrentAdded.bindWithEvent(this),
onTorrentChanged: this.onTorrentChanged.bindWithEvent(this)
}
@@ -57,6 +58,9 @@ Deluge.Widgets.AddWindow = new Class({
this.urlWindow.show();
}.bindWithEvent(this));
+ this.removeButton = this.content.getElement('button.remove');
+ this.removeButton.addEvent('click', this.bound.onRemoveClick);
+
this.content.getElement('button.add').addEvent('click', this.bound.onAdd);
this.content.getElement('button.cancel').addEvent('click', this.bound.onCancel);
},
@@ -96,6 +100,12 @@ Deluge.Widgets.AddWindow = new Class({
this.torrents.empty();
this.torrentInfo.empty();
this.filesTab.table.empty();
+ },
+
+ onRemoveClick: function(e) {
+ delete this.torrentInfo[this.torrents.value];
+ this.torrents.options[this.torrents.selectedIndex].dispose();
+ this.filesTab.setTorrent(null);
}
});
@@ -263,6 +273,7 @@ Deluge.Widgets.AddTorrent.FilesTab = new Class({
setTorrent: function(torrent) {
this.table.empty();
+ if (!torrent) return;
$each(torrent['files'], function(file) {
row = new Element('tr');
new Element('td').inject(row);