]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added some error checking.
authorThomas Tanghus <thomas@tanghus.net>
Tue, 26 Jun 2012 16:14:59 +0000 (18:14 +0200)
committerThomas Tanghus <thomas@tanghus.net>
Tue, 26 Jun 2012 16:15:24 +0000 (18:15 +0200)
apps/contacts/js/contacts.js

index 204fe18a52de0469e07887677054cc886d002db1..64b7af850ea9688d5bb9056470e31d027fcfdfd8 100644 (file)
@@ -258,6 +258,9 @@ Contacts={
                                        newid = id;
                                        bookid = bookid?bookid:$('#contacts li[data-id="'+newid+'"]').data('bookid');
                                }
+                               if(!bookid) {
+                                       bookid = $('#contacts h3').first().data('id');
+                               }
                                var localLoadContact = function(newid, bookid) {
                                        if($('.contacts li').length > 0) {
                                                $('#contacts li[data-id="'+newid+'"]').addClass('active');
@@ -315,7 +318,6 @@ Contacts={
                        },
                        add:function(n, fn, aid, isnew){ // add a new contact
                                aid = aid?aid:$('#contacts h3.active').first().data('id');
-                               console.log('add() aid: ' + aid);
                                var localAddcontact = function(n, fn, aid, isnew) {
                                        $.post(OC.filePath('contacts', 'ajax', 'addcontact.php'), { n: n, fn: fn, aid: aid, isnew: isnew },
                                        function(jsondata) {
@@ -1567,6 +1569,8 @@ Contacts={
                                                                        scroll: true, scrollSensitivity: 100,
                                                                        opacity: 0.7, helper: 'clone'
                                                                });
+                                                       } else {
+                                                               $('#contacts h3').first().addClass('active');
                                                        }
                                                });
                                                Contacts.UI.Card.update(id);