2016-09-13 17:39:01 -03:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
angular.module('copayApp.directives')
|
|
|
|
|
.directive('gravatar', function(md5) {
|
|
|
|
|
return {
|
|
|
|
|
restrict: 'AE',
|
|
|
|
|
replace: true,
|
|
|
|
|
scope: {
|
|
|
|
|
name: '@',
|
|
|
|
|
height: '@',
|
|
|
|
|
width: '@',
|
|
|
|
|
email: '@'
|
|
|
|
|
},
|
|
|
|
|
link: function(scope, el, attr) {
|
2017-02-20 13:06:42 -05:00
|
|
|
if (typeof scope.email === "string") {
|
2016-10-18 18:26:02 -04:00
|
|
|
scope.emailHash = md5.createHash(scope.email.toLowerCase() || '');
|
|
|
|
|
}
|
2016-09-13 17:39:01 -03:00
|
|
|
},
|
2017-02-20 13:06:42 -05:00
|
|
|
template: '<img class="gravatar" alt="{{ name }}" height="{{ height }}" width="{{ width }}" src="https://secure.gravatar.com/avatar/{{ emailHash }}.jpg?s={{ width }}&d=mm">'
|
2016-11-01 14:56:53 -04:00
|
|
|
};
|
2016-09-13 17:39:01 -03:00
|
|
|
});
|