new send-tab

This commit is contained in:
Sebastiaan Pasma 2018-07-09 18:22:11 +02:00
commit 1ee95cf262
16 changed files with 907 additions and 17 deletions

View file

@ -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 }}">'
};
});