From cde3375be8016f235c5aabb3f7159ba87eaede54 Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Sun, 3 Jun 2012 08:41:21 -0400
Subject: [PATCH] - Patch #1016056 by nod_: added Hide tabledrag handle and
 'Show row weights' when there is only one item in list.

---
 core/misc/tabledrag.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/core/misc/tabledrag.js b/core/misc/tabledrag.js
index 273dcc1b28e8..a36d0aeb079d 100644
--- a/core/misc/tabledrag.js
+++ b/core/misc/tabledrag.js
@@ -84,7 +84,10 @@ Drupal.tableDrag = function (table, tableSettings) {
 
   // Make each applicable row draggable.
   // Match immediate children of the parent element to allow nesting.
-  $table.find('> tr.draggable, > tbody > tr.draggable').each(function () { self.makeDraggable(this); });
+  var $rows = $table.find('> tr.draggable, > tbody > tr.draggable');
+  if ($rows.length > 1) {
+    $rows.each(function () { self.makeDraggable(this); });
+  }
 
   // Add a link before the table for users to show or hide weight columns.
   $table.before($('<a href="#" class="tabledrag-toggle-weight"></a>')
-- 
GitLab