Improved error handling.

This commit is contained in:
Martin Edenhofer 2014-09-25 01:11:42 +02:00
parent d7979474af
commit 4dafa05048

View file

@ -37,16 +37,20 @@ class App.User extends App.Model
"user icon" "user icon"
initials: -> initials: ->
if @firstname[0] && @lastname[0] if @firstname && @lastname && @firstname[0] && @lastname[0]
@firstname[0] + @lastname[0] return @firstname[0] + @lastname[0]
else if @firstname[0] && !@lastname[0] else if @firstname && @firstname[0] && !@lastname
@firstname[0] + @firstname[1] if @firstname[1]
else if !@firstname[0] && @lastname[0] return @firstname[0] + @firstname[1]
@lastname[0] + @lastname[1] return @firstname[0]
else if !@firstname && @lastname && @lastname[0]
if @lastname[1]
return @lastname[0] + @lastname[1]
return @lastname[0]
else if @email else if @email
@email[0] + @email[1] return @email[0] + @email[1]
else else
'??' return '??'
avatar: (big = false, placement = '', cssClass = '') -> avatar: (big = false, placement = '', cssClass = '') ->
if big if big