Better visual feedback and prevent drop on self.

This commit is contained in:
Thomas Tanghus 2012-06-25 18:23:48 +02:00
parent b8d6ad0431
commit dc4b891327
2 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; } #contacts { position: fixed; background: #fff; max-width: 100%; width: 20em; left: 12.5em; top: 3.7em; bottom: 3em; overflow: auto; padding: 0; margin: 0; }
.contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; } .contacts a { height: 23px; display: block; left: 12.5em; margin: 0 0 0 0; padding: 0 0 0 25px; }
.contacts li.ui-draggable { height: 23px; width: 20em; } .contacts li.ui-draggable { height: 23px; width: 20em; }
.ui-state-hover { border: 1px solid dashed; }
#bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;} #bottomcontrols { padding: 0; bottom:0px; height:2.8em; width: 20em; margin:0; background:#eee; border-top:1px solid #ccc; position:fixed; -moz-box-shadow: 0 -3px 3px -3px #000; -webkit-box-shadow: 0 -3px 3px -3px #000; box-shadow: 0 -3px 3px -3px #000;}
#contacts_newcontact { float: left; margin: 0.2em 0 0 1em; } #contacts_newcontact { float: left; margin: 0.2em 0 0 1em; }
#chooseaddressbook { float: right; margin: 0.2em 1em 0 0; } #chooseaddressbook { float: right; margin: 0.2em 1em 0 0; }

View File

@ -1551,8 +1551,17 @@ Contacts={
})}, 100); })}, 100);
setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/ setTimeout(Contacts.UI.Contacts.lazyupdate, 500);*/
if($('#contacts h3').length > 1) { if($('#contacts h3').length > 1) {
$('#contacts h3,#contacts ul').droppable({ drop: Contacts.UI.Contacts.drop}); $('#contacts h3,#contacts ul').each(function(index) {
var id = $(this).data('id');
var accept = 'li:not([data-bookid="'+id+'"])';
$(this).droppable({
drop: Contacts.UI.Contacts.drop,
activeClass: 'ui-state-hover',
accept: accept
});
});
$('#contacts li').draggable({ $('#contacts li').draggable({
revert: 'invalid',
axis: 'y', containment: '#contacts', axis: 'y', containment: '#contacts',
scroll: true, scrollSensitivity: 100, scroll: true, scrollSensitivity: 100,
opacity: 0.7, helper: 'clone' opacity: 0.7, helper: 'clone'