Skip to content
Snippets Groups Projects
Commit 9ad360a3 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Get avatar using username

parent e4b008ff
No related merge requests found
...@@ -663,7 +663,12 @@ a.github-fork { ...@@ -663,7 +663,12 @@ a.github-fork {
height: 100%; height: 100%;
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
position: relative;
.avatar-image { .avatar-image {
height: 100%;
width: 100%;
min-height: 40px;
min-width: 40px;
display: block; display: block;
background-color: transparent; background-color: transparent;
background-size: cover; background-size: cover;
......
Template.avatar.helpers
dimensions: ->
return {
width: 40
height: 40
}
imageUrl: ->
username = this.username
if not username? and this.userId?
username = Meteor.users.findOne(this.userId)?.username
url = "#{Meteor.absoluteUrl()}/avatar/#{username}"
return url
\ No newline at end of file
<template name="avatar">
<div class="avatar">
<img class="avatar-image" src="/images/pixel.png" style="background-image:url({{imageUrl}});" alt="avatar" />
<span class="avatar-initials" style="{{initialsCss}}">{{initialsText}}</span>
</div>
</template>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment