1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Contacts: Fix cancelling new contact creation.

This commit is contained in:
Thomas Tanghus 2012-11-15 20:35:35 +01:00
parent 16e1db3113
commit 5a5c55eb98

View File

@ -680,6 +680,7 @@ OC.Contacts = OC.Contacts || {
$(document).bind('status.contact.added', function(e, data) { $(document).bind('status.contact.added', function(e, data) {
self.currentid = parseInt(data.id); self.currentid = parseInt(data.id);
self.buildGroupSelect();
self.showActions(['back', 'download', 'delete', 'groups']); self.showActions(['back', 'download', 'delete', 'groups']);
}); });
@ -1066,7 +1067,9 @@ OC.Contacts = OC.Contacts || {
self.$contactList.hide(); self.$contactList.hide();
self.$toggleAll.hide(); self.$toggleAll.hide();
$(this).hide(); $(this).hide();
self.$rightContent.prepend(self.Contacts.addContact()); self.currentid = 'new';
self.tmpcontact = self.Contacts.addContact();
self.$rightContent.prepend(self.tmpcontact);
self.showActions(['back']); self.showActions(['back']);
}); });
@ -1280,9 +1283,12 @@ OC.Contacts = OC.Contacts || {
if(this.Contacts.findById(id).close()) { if(this.Contacts.findById(id).close()) {
this.$contactList.show(); this.$contactList.show();
this.jumpToContact(id); this.jumpToContact(id);
delete this.currentid;
} }
} else if(this.currentid === 'new') {
this.tmpcontact.remove();
this.$contactList.show();
} }
delete this.currentid;
this.$groups.find('optgroup,option:not([value="-1"])').remove(); this.$groups.find('optgroup,option:not([value="-1"])').remove();
}, },
openContact: function(id) { openContact: function(id) {