summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2009-01-16 10:08:46 +0000
committerChristopher Lenz <cmlenz@apache.org>2009-01-16 10:08:46 +0000
commit19a1c58f04cef79e188ac603e5dbdd5d284d48e0 (patch)
treea5a472aa7ea456222ea44d31b17188ac40c44673
parented46f6d82b80825695ee7d951721c759dc7d1103 (diff)
In the Futon document view, delete the whole _attachments row when the only/last attachment is removed.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@734955 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--share/www/script/futon.browse.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js
index d13724ea..cdd3a41e 100644
--- a/share/www/script/futon.browse.js
+++ b/share/www/script/futon.browse.js
@@ -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));