From 1e24f764c195f30d79fbcd690c1577097e8f331a Mon Sep 17 00:00:00 2001
From: Jordan Lee <jordan@transmissionbt.com>
Date: Wed, 31 Aug 2011 01:12:04 +0000
Subject: [PATCH] (trunk web) #4452 "Pause / Resume buttons to the right of all
 torrents are nonfunctional" -- fixed.

---
 web/javascript/transmission.js | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js
index 9f8af48d8..c5edb1a29 100644
--- a/web/javascript/transmission.js
+++ b/web/javascript/transmission.js
@@ -1337,12 +1337,16 @@ Transmission.prototype =
 
 	onToggleRunningClicked: function(ev)
 	{
-		var torrent = ev.data.r.getTorrent();
-
-		if (torrent.isStopped())
-			this.startTorrent(torrent);
-		else
-			this.stopTorrent(torrent);
+		var t, i, e;
+		e = $(ev.target).closest('.torrent')[0];
+		i = $('#torrent_list > li').index(e);
+		if ((0<=i) && (i<this._rows.length)) {
+			t = this._rows[i].getTorrent();
+			if (t.isStopped())
+				this.startTorrent(t);
+			else
+				this.stopTorrent(t);
+		}
 	},
 
 	setEnabled: function(key, flag)
@@ -1997,6 +2001,8 @@ Transmission.prototype =
 				row = new TorrentRow(renderer, this, t);
 				row.getElement().row = row;
 				dirty_rows.push(row);
+				if ((e = row.getToggleRunningButton()))
+					$(e).click($.proxy(this.onToggleRunningClicked,this));
 			}
 		}
 
-- 
2.40.0