Skip to content

Commit

Permalink
Prevent avatar image in avatar prompt option for initials
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Jun 4, 2015
1 parent eab3a63 commit 8d91297
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions client/views/avatar/avatar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ Template.avatar.helpers
return colors[position]

imageUrl: ->
if this.preventImage?
return

username = this.username
random = Session.get('AvatarRandom')
if not username? and this.userId?
username = Meteor.users.findOne(this.userId)?.username
url = "#{Meteor.absoluteUrl()}avatar/#{username}.jpg?_dc=#{random}"
return url

if not username?
return

return "background-image:url(#{Meteor.absoluteUrl()}avatar/#{username}.jpg?_dc=#{random});"
2 changes: 1 addition & 1 deletion client/views/avatar/avatar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template name="avatar">
<div class="avatar" initials="{{initials}}" style="background-color:{{color}}">
<div class="avatar-image" style="background-image:url({{imageUrl}});">
<div class="avatar-image" style="{{imageUrl}}">
</div>
</div>
</template>
2 changes: 1 addition & 1 deletion client/views/avatar/avatarPrompt.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2>{{_ "avatar.Select_an_avatar"}}</h2>
<div class="avatar-suggestions">
{{#if suggestions.ready}}
<div class="avatar-suggestion-item">
{{> avatar username=username}}
{{> avatar username=username preventImage='true'}}
{{#with service='initials'}}
<button type="button" class="button primary select-service">{{_ "avatar.Use_initials_avatar" }}</button>
{{/with}}
Expand Down

0 comments on commit 8d91297

Please sign in to comment.