new send-tab
This commit is contained in:
parent
0b2a793f57
commit
1ee95cf262
16 changed files with 907 additions and 17 deletions
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('gravatar', function(md5) {
|
||||
.directive('gravatar', function(md5, $http) {
|
||||
return {
|
||||
restrict: 'AE',
|
||||
replace: true,
|
||||
|
|
@ -9,13 +9,24 @@ angular.module('copayApp.directives')
|
|||
name: '@',
|
||||
height: '@',
|
||||
width: '@',
|
||||
email: '@'
|
||||
email: '@',
|
||||
url: '@'
|
||||
},
|
||||
link: function(scope, el, attr) {
|
||||
if (typeof scope.email === "string") {
|
||||
scope.emailHash = md5.createHash(scope.email.toLowerCase() || '');
|
||||
var req = {
|
||||
method: 'GET',
|
||||
url: 'https://secure.gravatar.com/'+scope.emailHash+'.json',
|
||||
};
|
||||
scope.url = 'img/contact-placeholder.svg';
|
||||
$http(req).then(function (response) {
|
||||
scope.url = 'https://secure.gravatar.com/avatar/'+scope.emailHash+'.jpg?s='+scope.width+'&d=mm';
|
||||
}, function (error) {
|
||||
scope.url = 'img/contact-placeholder.svg';
|
||||
});
|
||||
}
|
||||
},
|
||||
template: '<img class="gravatar" alt="{{ name }}" height="{{ height }}" width="{{ width }}" src="https://secure.gravatar.com/avatar/{{ emailHash }}.jpg?s={{ width }}&d=mm">'
|
||||
template: '<img class="gravatar" alt="{{ name }}" height="{{ height }}" width="{{ width }}" src="{{ url }}">'
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue