From 294e65fa38b3ba5575285c65f11eeb80000ffbe2 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 22 Jul 2012 01:34:05 +0200 Subject: [PATCH] Use insertContact --- apps/contacts/js/contacts.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index dcfd8e71d9..7c1304c559 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -1510,21 +1510,12 @@ Contacts={ $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') }, function(jsondata){ if(jsondata.status == 'success'){ - // Do some inserting/removing/sorting magic - var name = $(dragitem).find('a').html(); - var added = false; - $(droplist).children().each(function(){ - if ($(this).text().toLowerCase() > name.toLowerCase()) { - $(this).before(dragitem.detach()); //.fadeIn('slow'); - added = true; - return false; - } - }); - if(!added) { - $(droplist).append(dragitem.detach()); - } dragitem.attr('data-bookid', droptarget.data('id')) dragitem.data('bookid', droptarget.data('id')); + Contacts.UI.Contacts.insertContact({ + contactlist:droplist, + contact:dragitem.detach() + }); Contacts.UI.Contacts.scrollTo(dragitem.data('id')); } else { OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));