Ensure event handlers are being set when adding first contact.

This commit is contained in:
Thomas Tanghus 2012-06-27 02:10:50 +02:00
parent afd9705283
commit 823bef3a09
1 changed files with 24 additions and 24 deletions

View File

@ -234,6 +234,30 @@ Contacts={
$('#contacts_downloadcard').tipsy({gravity: 'ne'});
$('#contacts_propertymenu_button').tipsy();
$('#contacts_newcontact, #chooseaddressbook').tipsy({gravity: 'sw'});
$('body').click(function(e){
if(!$(e.target).is('#contacts_propertymenu_button')) {
$('#contacts_propertymenu_dropdown').hide();
}
});
function propertyMenu(){
var menu = $('#contacts_propertymenu_dropdown');
if(menu.is(':hidden')) {
menu.show();
menu.find('li').first().focus();
} else {
menu.hide();
}
}
$('#contacts_propertymenu_button').click(propertyMenu);
$('#contacts_propertymenu_button').keydown(propertyMenu);
function propertyMenuItem(){
var type = $(this).data('type');
Contacts.UI.Card.addProperty(type);
$('#contacts_propertymenu_dropdown').hide();
}
$('#contacts_propertymenu_dropdown a').click(propertyMenuItem);
$('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem);
},
Card:{
id:'',
@ -1739,30 +1763,6 @@ $(document).ready(function(){
xhr.send(file);
}
$('body').click(function(e){
if(!$(e.target).is('#contacts_propertymenu_button')) {
$('#contacts_propertymenu_dropdown').hide();
}
});
function propertyMenu(){
var menu = $('#contacts_propertymenu_dropdown');
if(menu.is(':hidden')) {
menu.show();
menu.find('li').first().focus();
} else {
menu.hide();
}
}
$('#contacts_propertymenu_button').click(propertyMenu);
$('#contacts_propertymenu_button').keydown(propertyMenu);
function propertyMenuItem(){
var type = $(this).data('type');
Contacts.UI.Card.addProperty(type);
$('#contacts_propertymenu_dropdown').hide();
}
$('#contacts_propertymenu_dropdown a').click(propertyMenuItem);
$('#contacts_propertymenu_dropdown a').keydown(propertyMenuItem);
Contacts.UI.loadHandlers();
Contacts.UI.Contacts.update(id);
});