This commit is contained in:
Ruud committed 2014-02-12 08:24:15 +01:00
1 parent a6be59bbea
commit 3bbeec513a
1 file changed
+9 -5
+9 -5
View File
@@ -38,7 +38,7 @@
) )
), ),
new Element('td.actions').grab( new Element('td.actions').grab(
new Element('a.delete', {'text': 'delete', 'data-id': doc['_id']}) new Element('a.delete[href=#]', {'text': 'delete', 'data-id': doc['_id']})
) )
).inject(list) ).inject(list)
}); });
@@ -51,10 +51,13 @@
var c = $('container'); var c = $('container');
// Delete // Delete
c.addEvent('click:relay(.delete)', function(e){ c.addEvents({
// Delete delegate
'click:relay(.delete)': function(e){
(e).stop(); (e).stop();
if(confirm('Are you sure?')){ if(!document.location.href.contains('no_confirm') && confirm('Are you sure?')){
var a = this; var a = this;
new Request.JSON({ new Request.JSON({
@@ -67,10 +70,10 @@
} }
}).send(); }).send();
} }
}); },
// Form submit // Form submit
c.addEvent('submit:relay(form)', function(e){ 'submit:relay(form)': function(e){
(e).stop(); (e).stop();
var form = this; var form = this;
@@ -85,6 +88,7 @@
form.getParent('tr').getElement('._rev').set('text', response.document['_rev']); form.getParent('tr').getElement('._rev').set('text', response.document['_rev']);
} }
}).send(); }).send();
}
}); });
new Request.JSON({ new Request.JSON({