diff --git a/UI/Templates/AdministrationUI/UIxAdministration.wox b/UI/Templates/AdministrationUI/UIxAdministration.wox index 269c1f784..8cc96cdb2 100644 --- a/UI/Templates/AdministrationUI/UIxAdministration.wox +++ b/UI/Templates/AdministrationUI/UIxAdministration.wox @@ -81,17 +81,11 @@
+ ng-click="app.selectUser($index)" + aria-label="{{::user.c_email}}"> - - -
- -
+ size="40">{{::user.$avatarIcon}}
{{::user.cn}}
diff --git a/UI/Templates/AdministrationUI/UIxAdministrationAclEditor.wox b/UI/Templates/AdministrationUI/UIxAdministrationAclEditor.wox index 4ff9ec262..fcebf1ad2 100644 --- a/UI/Templates/AdministrationUI/UIxAdministrationAclEditor.wox +++ b/UI/Templates/AdministrationUI/UIxAdministrationAclEditor.wox @@ -25,10 +25,8 @@
-
+ size="40">{{acl.user.$avatarIcon}}

{{::acl.user.cn}}

diff --git a/UI/Templates/ContactsUI/UIxContactFoldersView.wox b/UI/Templates/ContactsUI/UIxContactFoldersView.wox index fed259a41..2eff53ddf 100644 --- a/UI/Templates/ContactsUI/UIxContactFoldersView.wox +++ b/UI/Templates/ContactsUI/UIxContactFoldersView.wox @@ -463,22 +463,10 @@ label:aria-label="Toggle item" ng-class="{ 'sg-avatar-selected': currentCard.selected }" ng-click="addressbook.toggleCardSelection($event, currentCard)"> - - - - - - -
- -
+ size="40">{{ currentCard.$avatarIcon }}
diff --git a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox index d6c711b5c..4653e8a1b 100644 --- a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox @@ -57,15 +57,10 @@
-
- -
-
- -
+ {{ editor.card.$avatarIcon }}

{{editor.card.$description()}}
@@ -93,9 +88,7 @@ - - + size="48">person

{{ ref.$fullname() }} diff --git a/UI/Templates/ContactsUI/UIxContactsUserFolders.wox b/UI/Templates/ContactsUI/UIxContactsUserFolders.wox index a144d7ccb..a353e79ca 100644 --- a/UI/Templates/ContactsUI/UIxContactsUserFolders.wox +++ b/UI/Templates/ContactsUI/UIxContactsUserFolders.wox @@ -39,13 +39,9 @@ 'sg-expanded': user.uid == subscribe.selectedUser.uid }">
- - -
-
+ {{ user.$avatarIcon }}
{{user.cn}}
{{user.c_email}}
diff --git a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox index 7f31d0989..5fa331b04 100644 --- a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox +++ b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox @@ -260,7 +260,7 @@ readonly="true">
- + person
{{$chip.name}}
diff --git a/UI/Templates/MailerUI/UIxMailEditor.wox b/UI/Templates/MailerUI/UIxMailEditor.wox index 7151d182e..86490f56d 100644 --- a/UI/Templates/MailerUI/UIxMailEditor.wox +++ b/UI/Templates/MailerUI/UIxMailEditor.wox @@ -16,7 +16,7 @@ + size="32">person + size="40">person
+ size="40">person
{{user.cn}}
{{user.c_email}}
diff --git a/UI/Templates/MailerUI/UIxMailViewTemplate.wox b/UI/Templates/MailerUI/UIxMailViewTemplate.wox index f0503febc..8d1c02ebe 100644 --- a/UI/Templates/MailerUI/UIxMailViewTemplate.wox +++ b/UI/Templates/MailerUI/UIxMailViewTemplate.wox @@ -127,9 +127,7 @@
- - + size="40">person
{{ viewer.message.from[0].name }}
- + person
{{$chip.name || $chip.email}}
diff --git a/UI/Templates/SchedulerUI/UIxAttendeesEditor.wox b/UI/Templates/SchedulerUI/UIxAttendeesEditor.wox index 40afbc233..55bfc74e1 100644 --- a/UI/Templates/SchedulerUI/UIxAttendeesEditor.wox +++ b/UI/Templates/SchedulerUI/UIxAttendeesEditor.wox @@ -19,7 +19,7 @@ + size="40">person
{{currentAttendee.name}}
{{currentAttendee.email}}
diff --git a/UI/Templates/UIxAclEditor.wox b/UI/Templates/UIxAclEditor.wox index 3388c00aa..21b8727a7 100644 --- a/UI/Templates/UIxAclEditor.wox +++ b/UI/Templates/UIxAclEditor.wox @@ -51,15 +51,11 @@ ng-class="{ 'sg-expanded': user.uid == acl.selectedUid }">
- -
- -
-
-
-
+
+ {{ user.$avatarIcon }} +
{{user.cn}}
{{user.c_email}}
diff --git a/UI/Templates/UIxSidenavToolbarTemplate.wox b/UI/Templates/UIxSidenavToolbarTemplate.wox index 4c3af405c..c804459aa 100644 --- a/UI/Templates/UIxSidenavToolbarTemplate.wox +++ b/UI/Templates/UIxSidenavToolbarTemplate.wox @@ -7,7 +7,7 @@ + size="40">person

{{activeUser.identification}}

diff --git a/UI/WebServerResources/js/Common/User.service.js b/UI/WebServerResources/js/Common/User.service.js index dd433db65..ec15c6f8b 100644 --- a/UI/WebServerResources/js/Common/User.service.js +++ b/UI/WebServerResources/js/Common/User.service.js @@ -114,6 +114,7 @@ this.$$shortFormat = this.$shortFormat(); if (!this.$$image) this.$$image = this.image; + this.$avatarIcon = (this.$isGroup() || this.$isSpecial()) ? 'group' : 'person'; // NOTE: We can't assign a Gravatar at this stage since we would need the Preferences module // which already depend on the User module. @@ -175,6 +176,15 @@ return deferred.promise; }; + /** + * @function $isGroup + * @memberof User.prototype + * @return true if the user actually represents a group of users + */ + User.prototype.$isGroup = function() { + return this.isGroup || this.userClass && this.userClass == 'normal-group'; + }; + /** * @function $isAnonymous * @memberof User.prototype diff --git a/UI/WebServerResources/js/Common/sgAvatarImage.directive.js b/UI/WebServerResources/js/Common/sgAvatarImage.directive.js index 9983be871..213670fe1 100644 --- a/UI/WebServerResources/js/Common/sgAvatarImage.directive.js +++ b/UI/WebServerResources/js/Common/sgAvatarImage.directive.js @@ -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: - + person */ function sgAvatarImage() { return { @@ -21,8 +21,9 @@ email: '=sgEmail', src: '=sgSrc' }, + transclude: true, template: [ - 'person', // the generic icon + '', // the generic icon '' // the gravatar or local image ].join(''), link: link, diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index 603242c1a..d339b1a55 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -154,6 +154,7 @@ }); if (this.isgroup) this.c_component = 'vlist'; + this.$avatarIcon = this.$isList()? 'group' : 'person'; if (data.notes && data.notes.length) this.notes = _.map(data.notes, function(note) { return { 'value': note }; }); else if (!this.notes || !this.notes.length) diff --git a/UI/WebServerResources/js/Scheduler/Component.service.js b/UI/WebServerResources/js/Scheduler/Component.service.js index 7870455f6..8f234313a 100644 --- a/UI/WebServerResources/js/Scheduler/Component.service.js +++ b/UI/WebServerResources/js/Scheduler/Component.service.js @@ -873,7 +873,8 @@ email: ref.$preferredEmail(), role: 'req-participant', partstat: 'needs-action', - uid: ref.c_uid + uid: ref.c_uid, + $avatarIcon: 'person', }; if (!_.find(_this.attendees, function(o) { return o.email == attendee.email; @@ -896,7 +897,8 @@ email: card.$preferredEmail(), role: 'req-participant', partstat: 'needs-action', - uid: card.c_uid + uid: card.c_uid, + $avatarIcon: card.$avatarIcon }; if (!_.find(this.attendees, function(o) { return o.email == attendee.email;