Re-factor the avatar system and support avatar uploads

The user is now able to upload an avatar, and pick one in a list.

This functionality should eventually be abstracted in a community
package but we still need to work on a great public API. We rely on
collectionFS to manage uploaded avatars. We also removed
bengott:avatar which was trying to solve the wrong problem (namely
displaying the avatar, which is as simple as displaying an image), and
not a avatar system as it should be.

Gravatar support is coming (back) soon. We may also want to have a
list of default fun avatars the user can choose instead of uploading
its own one.
This commit is contained in:
Maxime Quandalle 2015-06-08 11:47:06 +02:00
parent 98d7278d08
commit 46cc691534
22 changed files with 161 additions and 227 deletions

View file

@ -1,22 +1,42 @@
template(name="userAvatar")
.member.js-member(class="{{class}}" title="{{userData.profile.name}} ({{userData.username}})")
+avatar(user=userData size=size)
.member.js-member(title="{{userData.profile.fullname}} ({{userData.username}})")
if userData.profile.avatarUrl
img.avatar.avatar-image(src=userData.profile.avatarUrl)
if showStatus
span.member-presence-status(class=presenceStatusClassName)
span.member-type(class=memberType)
template(name="userPopup")
.board-member-menu
.mini-profile-info
+userAvatar(user=user)
.info
h3.bottom
a.js-profile(href="{{ pathFor route='Profile' username=user.username }}")= user.profile.name
p.quiet.bottom @{{ user.username }}
.info
h3.bottom
a.js-profile(href="{{pathFor route='Profile' username=user.username}}")= user.profile.name
p.quiet.bottom @{{ user.username }}
template(name="memberName")
a.inline-object.js-show-mem-menu(href="{{ pathFor route='Profile' username=user.username }}")
= user.profile.name
a.js-show-mem-menu(href="{{pathFor route='Profile' username=user.username}}")
= user.profile.fullname
if username
| ({{ user.username }})
template(name="changeAvatarPopup")
ul.pop-over-list
each uploadedAvatars
li: a.js-select-avatar
.member: .avatar
img.avatar-image(src="{{url avatarUrlOptions}}")
| Uploaded avatar
if isSelected
i.fa.fa-check
p.sub-name
unless isSelected
a.js-delete-avatar
| Delete
| -
= original.name
input.hide.js-upload-avatar-input(accept="image/*;capture=camera" type="file")
button.full.js-upload-avatar
i.fa.fa-upload
| Upload an avatar