mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-30 19:52:17 +01:00
Use insertContact
This commit is contained in:
parent
9ead8e1ac4
commit
b59c9e187e
@ -1510,21 +1510,12 @@ Contacts={
|
|||||||
$.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') },
|
$.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: droptarget.data('id') },
|
||||||
function(jsondata){
|
function(jsondata){
|
||||||
if(jsondata.status == 'success'){
|
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.attr('data-bookid', droptarget.data('id'))
|
||||||
dragitem.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'));
|
Contacts.UI.Contacts.scrollTo(dragitem.data('id'));
|
||||||
} else {
|
} else {
|
||||||
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user