Avatars: replace image with initials when printing

This commit is contained in:
Felix Niklas 2018-10-23 15:38:43 +02:00
parent 47120f0585
commit a3e531af21
3 changed files with 31 additions and 1 deletions

View file

@ -105,6 +105,7 @@ class App.User extends App.Model
placement: placement placement: placement
vip: vip vip: vip
url: @imageUrl() url: @imageUrl()
initials: @initials()
isOutOfOffice: -> isOutOfOffice: ->
return false if @out_of_office isnt true return false if @out_of_office isnt true

View file

@ -1,3 +1,3 @@
<span class="avatar <%- @cssClass %>" style="background-image: url(<%- @url %>)"<%- @placement %><%- @data %>> <span class="avatar <%- @cssClass %>" style="background-image: url(<%- @url %>)"<%- @placement %><%- @data %> data-initials="<%- @initials %>">
<%- @Icon('crown') if @vip %> <%- @Icon('crown') if @vip %>
</span> </span>

View file

@ -201,6 +201,35 @@ th.js-tableHead:not([data-column-key="icon"]) {
.avatar { .avatar {
border: 1px solid black; border: 1px solid black;
&:not(.avatar--unique) {
&:before {
content: attr(data-initials);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
text-align: center;
font-size: 13px;
line-height: 40px;
}
&.size-30:before {
font-size: 10px;
line-height: 32px;
}
&.size-50:before {
font-size: 16px;
line-height: 52px;
}
&.size-80:before {
font-size: 26px;
line-height: 84px;
}
}
} }