mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-19 18:18:12 +00:00
(js) Improve sgAvatarImage
This commit is contained in:
1 parent
0a75f5c4f7
commit
3bbd61cfd2
18 files changed
+45
-68
No files matched your search
@@ -6,11 +6,11 @@
|
||||
|
||||
/**
|
||||
* sgAvatarImage - An avatar directive that returns un img element with either a local URL (if sg-src is specified)
|
||||
* or a Gravatar URL built from the Gravatar factory (using sg-email).
|
||||
* or a Gravatar URL built from the Gravatar factory (using sg-email). The element's content must return the name of the generic icon to be used (usually 'person' or 'group').
|
||||
* Based on http://blog.lingohub.com/2014/08/better-ux-with-angularjs-directives/.
|
||||
* @memberof SOGo.Common
|
||||
* @example:
|
||||
<sg-avatar-image sg-email="test@email.com" size="50"></sg-avatar-image>
|
||||
<sg-avatar-image sg-email="test@email.com" size="50">person</sg-avatar-image>
|
||||
*/
|
||||
function sgAvatarImage() {
|
||||
return {
|
||||
@@ -21,8 +21,9 @@
|
||||
email: '=sgEmail',
|
||||
src: '=sgSrc'
|
||||
},
|
||||
transclude: true,
|
||||
template: [
|
||||
'<md-icon>person</md-icon>', // the generic icon
|
||||
'<md-icon ng-transclude></md-icon>', // the generic icon
|
||||
'<img class="ng-hide" ng-src="{{vm.url}}" />' // the gravatar or local image
|
||||
].join(''),
|
||||
link: link,
|
||||
|
||||
Reference in new issue
Block a user