You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2009/01/16 11:08:48 UTC

svn commit: r734955 - /couchdb/trunk/share/www/script/futon.browse.js

Author: cmlenz
Date: Fri Jan 16 02:08:46 2009
New Revision: 734955

URL: http://svn.apache.org/viewvc?rev=734955&view=rev
Log:
In the Futon document view, delete the whole _attachments row when the only/last attachment is removed.

Modified:
    couchdb/trunk/share/www/script/futon.browse.js

Modified: couchdb/trunk/share/www/script/futon.browse.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.browse.js?rev=734955&r1=734954&r2=734955&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/futon.browse.js [utf-8] (original)
+++ couchdb/trunk/share/www/script/futon.browse.js [utf-8] Fri Jan 16 02:08:46 2009
@@ -950,8 +950,14 @@
 
       function _initAttachmentItem(name, attachment, li) {
         $("<button type='button' class='delete' title='Delete attachment'></button>").click(function() {
-          delete page.doc._attachments[name];
-          li.remove();
+          if (!li.siblings("li").length) {
+            delete page.doc._attachments;
+            li.parents("tr").remove();
+            $("#fields tbody.content tr").removeClass("odd").filter(":odd").addClass("odd");
+          } else {
+            delete page.doc._attachments[name];
+            li.remove();
+          }
           page.isDirty = true;
           return false;
         }).prependTo($("a", li));