summaryrefslogtreecommitdiffstats
path: root/apps/contacts
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-07-15 21:34:56 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-07-16 01:46:16 +0200
commit8fba6b9bc72f93c13e0984dd832b84a15152986a (patch)
treeca95954374cad3b54c1dc09b06f2b61129b6fc55 /apps/contacts
parent502f4206780eaa6a694fe054b687975ab7671385 (diff)
downloadnextcloud-server-8fba6b9bc72f93c13e0984dd832b84a15152986a.tar.gz
nextcloud-server-8fba6b9bc72f93c13e0984dd832b84a15152986a.zip
UI part of addressbook merging.
Diffstat (limited to 'apps/contacts')
-rw-r--r--apps/contacts/js/contacts.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js
index 30e1e272125..2fcead42f51 100644
--- a/apps/contacts/js/contacts.js
+++ b/apps/contacts/js/contacts.js
@@ -1456,20 +1456,26 @@ Contacts={
batchnum:50,
drop:function(event, ui) {
var dragitem = ui.draggable, droptarget = $(this);
- //console.log('Drop ' + dragitem.data('id') +' on: ' + droptarget.data('id'));
+ if(dragitem.is('li')) {
+ Contacts.UI.Contacts.dropContact(event, dragitem, droptarget);
+ } else {
+ Contacts.UI.Contacts.dropAddressbook(event, dragitem, droptarget);
+ }
+ },
+ dropContact:function(event, dragitem, droptarget) {
if(dragitem.data('bookid') == droptarget.data('id')) {
return false;
}
var droplist = (droptarget.is('ul'))?droptarget:droptarget.next();
- $.post(OC.filePath('contacts', 'ajax', 'movetoaddressbook.php'), { ids: dragitem.data('id'), aid: $(this).data('id') },
+ $.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');
+ if (droptarget.text().toLowerCase() > name.toLowerCase()) {
+ droptarget.before(dragitem.detach()); //.fadeIn('slow');
added = true;
return false;
}
@@ -1485,6 +1491,9 @@ Contacts={
}
});
},
+ dropAddressbook:function(event, dragitem, droptarget) {
+ alert('Dropping address books not implemented yet');
+ },
// Reload the contacts list.
update:function(params){
if(!params) { params = {}; }
@@ -1534,7 +1543,7 @@ Contacts={
$('#contacts ul[data-id="'+b+'"]').slideToggle(300);
return false;
});
- var accept = 'li:not([data-bookid="'+b+'"])';
+ var accept = 'li:not([data-bookid="'+b+'"]),h3:not([data-id="'+b+'"])';
$('#contacts h3[data-id="'+b+'"],#contacts ul[data-id="'+b+'"]').droppable({
drop: Contacts.UI.Contacts.drop,
activeClass: 'ui-state-hover',
@@ -1562,7 +1571,7 @@ Contacts={
}
});
if($('#contacts h3').length > 1) {
- $('#contacts li').draggable({
+ $('#contacts li,#contacts h3').draggable({
revert: 'invalid',
axis: 'y', containment: '#contacts',
scroll: true, scrollSensitivity: 100,