Merge branch 'master' into calendar_sharing

This commit is contained in:
Georg Ehrke 2012-03-27 20:53:40 +02:00
commit ede0a675bc
3 changed files with 33 additions and 4 deletions

View File

@ -613,10 +613,12 @@ Contacts={
this.loadPhoto(true);
$('#file_upload_form').show();
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
$('#file_upload_start').trigger('click');
break;
case 'NOTE':
$('#note').show();
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
$('#note').find('textarea').focus();
break;
case 'EMAIL':
if($('#emaillist>li').length == 1) {
@ -644,6 +646,7 @@ Contacts={
case 'BDAY':
case 'CATEGORIES':
$('dl dt[data-element="'+type+'"],dd[data-element="'+type+'"]').show();
$('dd[data-element="'+type+'"]').find('input').focus();
$('#contacts_propertymenu a[data-type="'+type+'"]').parent().hide();
break;
}
@ -667,9 +670,16 @@ Contacts={
console.log('NOTE or PHOTO');
Contacts.UI.propertyContainerFor(obj).hide();
Contacts.UI.propertyContainerFor(obj).data('checksum', '');
if(proptype == 'PHOTO') {
console.log('Delete PHOTO');
Contacts.UI.Contacts.refreshThumbnail(Contacts.UI.Card.id);
} else if(proptype == 'NOTE') {
$('#note').find('textarea').val('');
}
} else {
$('dl dt[data-element="'+proptype+'"],dd[data-element="'+proptype+'"]').hide();
$('dl dd[data-element="'+proptype+'"]').data('checksum', '');
$('dl dd[data-element="'+proptype+'"]').find('input').val('');
}
$('#contacts_propertymenu a[data-type="'+proptype+'"]').parent().show();
Contacts.UI.loading(obj, false);
@ -990,7 +1000,7 @@ Contacts={
OC.dialogs.alert(response.data.message, t('contacts', 'Error'));
}
});
$('#contacts [data-id="'+this.id+'"]').find('a').css('background','url(thumbnail.php?id='+this.id+'&refresh=1'+Math.random()+') no-repeat');
Contacts.UI.Contacts.refreshThumbnail(this.id);
},
addMail:function() {
//alert('addMail');
@ -1192,6 +1202,9 @@ Contacts={
$(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat');
}
});
},
refreshThumbnail:function(id){
$('#contacts [data-id="'+id+'"]').find('a').css('background','url(thumbnail.php?id='+id+'&refresh=1'+Math.random()+') no-repeat');
}
}
}

View File

@ -5,14 +5,25 @@
(function( $ ) {
$.widget('ui.multiple_autocomplete', {
_create: function() {
var self = this;
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split( term ).pop();
}
function showOptions() {
if(!self.element.autocomplete('widget').is(':visible') && self.element.val().trim() == '') {
self.element.autocomplete('search', '');
}
}
//console.log('_create: ' + this.options['id']);
var self = this;
this.element.bind('click', function( event ) {
showOptions();
});
this.element.bind('input', function( event ) {
showOptions();
});
this.element.bind('blur', function( event ) {
var tmp = self.element.val().trim();
if(tmp[tmp.length-1] == ',') {

View File

@ -17,7 +17,7 @@ Set the app specific values in your javascript file. This is what I've used for
OCCategories.app = 'contacts';
OCCategories.changed = Contacts.UI.Card.categoriesChanged;
If OCCategories.changed point is set that function will be called each time the categories have been changed
If OCCategories.changed is set that function will be called each time the categories have been changed
in the editor (add/delete/rescan) to allow the app to update the UI accordingly. The only argument to the function
is an array of the updated categories e.g.:
@ -25,4 +25,9 @@ OCCategories.changed = function(categories) {
for(var category in categories) {
console.log(categories[category]);
}
}
}
To show the categories editor call:
OCCategories.edit()