mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-19 08:52:22 +01:00
Contacts: Fix loading default contact image
This commit is contained in:
parent
d0ad2a5581
commit
6bc6d8f478
@ -1400,8 +1400,8 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
var finishLoad = function(image) {
|
var finishLoad = function(image) {
|
||||||
console.log('finishLoad', self.getDisplayName(), image.width, image.height);
|
console.log('finishLoad', self.getDisplayName(), image.width, image.height);
|
||||||
$(image).addClass('contactphoto');
|
$(image).addClass('contactphoto');
|
||||||
|
self.$photowrapper.removeClass('loading wait');
|
||||||
self.$photowrapper.css({width: image.width + 10, height: image.height + 10});
|
self.$photowrapper.css({width: image.width + 10, height: image.height + 10});
|
||||||
self.$photowrapper.removeClass('loading').removeClass('wait');
|
|
||||||
$(image).insertAfter($phototools).fadeIn();
|
$(image).insertAfter($phototools).fadeIn();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2080,7 +2080,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
$(document).trigger('status.contact.error', {
|
$(document).trigger('status.contact.error', {
|
||||||
message:
|
message:
|
||||||
t('contacts', 'Failed loading contacts from {addressbook}: {error}',
|
t('contacts', 'Failed loading contacts from {addressbook}: {error}',
|
||||||
{addressbook:addressBook['displayname'], error:err})
|
{addressbook:addressBook['displayname'], error:cbresponse.message})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -210,29 +210,21 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
*/
|
*/
|
||||||
Storage.prototype.getDefaultPhoto = function() {
|
Storage.prototype.getDefaultPhoto = function() {
|
||||||
console.log('Storage.getDefaultPhoto');
|
console.log('Storage.getDefaultPhoto');
|
||||||
if(!this._defaultPhoto) {
|
if(!this.defaultPhoto) {
|
||||||
|
var defer = $.Deferred();
|
||||||
var url = OC.imagePath('contacts', 'person_large.png');
|
var url = OC.imagePath('contacts', 'person_large.png');
|
||||||
this._defaultPhoto = new Image();
|
this.defaultPhoto = new Image();
|
||||||
$.when(
|
var self = this;
|
||||||
$(this._defaultPhoto)
|
$(this.defaultPhoto)
|
||||||
.load(function() {
|
.load(function() {
|
||||||
console.log('Default photo loaded', arguments);
|
defer.resolve(this);
|
||||||
}).error(function() {
|
}).error(function(event) {
|
||||||
console.log('Error loading default photo', arguments)
|
defer.reject();
|
||||||
}).attr('src', url)
|
}).attr('src', url)
|
||||||
)
|
return defer.promise();
|
||||||
.then(function(response) {
|
} else {
|
||||||
console.log('Storage.defaultPhoto', response);
|
return this.defaultPhoto;
|
||||||
})
|
}
|
||||||
.fail(function(jqxhr, textStatus, error) {
|
|
||||||
var err = textStatus + ', ' + error;
|
|
||||||
console.log( "Request Failed: " + err);
|
|
||||||
$(document).trigger('status.contact.error', {
|
|
||||||
message: t('contacts', 'Failed loading default photo: {error}', {error:err})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
return this._defaultPhoto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user