1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-02 14:24:10 +01:00

Contacts: Clone event handlers as well.

This commit is contained in:
Thomas Tanghus 2012-05-11 18:16:52 +02:00
parent ac84d328e5
commit 66df19d91b

View File

@ -84,7 +84,6 @@ Contacts={
loadListHandlers:function() { loadListHandlers:function() {
$('.propertylist li a.delete').unbind('click'); $('.propertylist li a.delete').unbind('click');
$('.propertylist li a.delete').unbind('keydown'); $('.propertylist li a.delete').unbind('keydown');
$('.globe,.mail,.delete,.edit,.tip').tipsy();
var deleteItem = function(obj) { var deleteItem = function(obj) {
obj.tipsy('hide'); obj.tipsy('hide');
Contacts.UI.Card.deleteProperty(obj, 'list'); Contacts.UI.Card.deleteProperty(obj, 'list');
@ -644,21 +643,18 @@ Contacts={
$('#emails').show(); $('#emails').show();
} }
Contacts.UI.Card.addMail(); Contacts.UI.Card.addMail();
Contacts.UI.loadListHandlers();
break; break;
case 'TEL': case 'TEL':
if($('#phonelist>li').length == 1) { if($('#phonelist>li').length == 1) {
$('#phones').show(); $('#phones').show();
} }
Contacts.UI.Card.addPhone(); Contacts.UI.Card.addPhone();
Contacts.UI.loadListHandlers();
break; break;
case 'ADR': case 'ADR':
if($('#addressdisplay>dl').length == 1) { if($('#addressdisplay>dl').length == 1) {
$('#addresses').show(); $('#addresses').show();
} }
Contacts.UI.Card.editAddress('new', true); Contacts.UI.Card.editAddress('new', true);
Contacts.UI.loadListHandlers();
break; break;
case 'NICKNAME': case 'NICKNAME':
case 'ORG': case 'ORG':
@ -848,7 +844,7 @@ Contacts={
var q = q = '?id=' + this.id; var q = q = '?id=' + this.id;
if(obj === 'new') { if(obj === 'new') {
isnew = true; isnew = true;
$('#addressdisplay dl').first().clone().insertAfter($('#addressdisplay dl').last()).show(); $('#addressdisplay dl').first().clone(true).insertAfter($('#addressdisplay dl').last()).show();
container = $('#addressdisplay dl').last(); container = $('#addressdisplay dl').last();
container.removeClass('template').addClass('propertycontainer'); container.removeClass('template').addClass('propertycontainer');
} else { } else {
@ -1147,7 +1143,7 @@ Contacts={
}, },
addMail:function() { addMail:function() {
//alert('addMail'); //alert('addMail');
$('#emaillist li.template:first-child').clone().appendTo($('#emaillist')).show(); $('#emaillist li.template:first-child').clone(true).appendTo($('#emaillist')).show().find('a .tip').tipsy();
$('#emaillist li.template:last-child').find('select').addClass('contacts_property'); $('#emaillist li.template:last-child').find('select').addClass('contacts_property');
$('#emaillist li.template:last-child').removeClass('template').addClass('propertycontainer'); $('#emaillist li.template:last-child').removeClass('template').addClass('propertycontainer');
$('#emaillist li:last-child').find('input[type="email"]').focus(); $('#emaillist li:last-child').find('input[type="email"]').focus();
@ -1186,7 +1182,7 @@ Contacts={
return false; return false;
}, },
addPhone:function() { addPhone:function() {
$('#phonelist li.template:first-child').clone().appendTo($('#phonelist')); //.show(); $('#phonelist li.template:first-child').clone(true).appendTo($('#phonelist')); //.show();
$('#phonelist li.template:last-child').find('select').addClass('contacts_property'); $('#phonelist li.template:last-child').find('select').addClass('contacts_property');
$('#phonelist li.template:last-child').removeClass('template').addClass('propertycontainer'); $('#phonelist li.template:last-child').removeClass('template').addClass('propertycontainer');
$('#phonelist li:last-child').find('input[type="text"]').focus(); $('#phonelist li:last-child').find('input[type="text"]').focus();