Show last name if only lastname exsists in displayNameLong() and displayName().

This commit is contained in:
Martin Edenhofer 2017-04-19 09:55:20 +02:00
parent 78ddb3b62e
commit 6859b22db6

View file

@ -17,13 +17,15 @@ class App.Model extends Spine.Model
return @name if @name
if @realname
return "#{@realname} <#{@email}>"
if @firstname
if !_.isEmpty(@firstname)
name = @firstname
if @lastname
if name
if !_.isEmpty(@lastname)
if _.isEmpty(name)
name = ''
else
name = name + ' '
name = name + @lastname
return name
return name if !_.isEmpty(name)
if @email
return @email
if @title
@ -34,20 +36,23 @@ class App.Model extends Spine.Model
displayNameLong: ->
return @name if @name
if @firstname
if !_.isEmpty(@firstname)
name = @firstname
if @lastname
if name
if !_.isEmpty(@lastname)
if _.isEmpty(name)
name = ''
else
name = name + ' '
name = name + @lastname
if @organization
if !_.isEmpty(name)
if !_.isEmpty(@organization)
if typeof @organization is 'object'
name = "#{name} (#{@organization.name})"
else
name = "#{name} (#{@organization})"
else if @department
else if !_.isEmpty(@department)
name = "#{name} (#{@department})"
return name
return name if !_.isEmpty(name)
if @email
return @email
if @title